Skip to content

Commit

Permalink
Allow BaseException for emitting broad-except, just like ``Ex…
Browse files Browse the repository at this point in the history
…ception``.

Close #2741
  • Loading branch information
PCManticore committed Feb 13, 2019
1 parent c95f911 commit 612b87a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -7,6 +7,10 @@ What's New in Pylint 2.3.0?

Release date: TBA

* Allow ``BaseException`` for emitting ``broad-except``, just like ``Exception``.

Close #2741

* Fixed a crash that occurred for ``bad-str-strip-call`` when ``strip()`` received ``None``

Close #2743
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/exceptions.py
Expand Up @@ -70,7 +70,7 @@ def _is_raising(body: typing.List) -> bool:


PY3K = sys.version_info >= (3, 0)
OVERGENERAL_EXCEPTIONS = ("Exception",)
OVERGENERAL_EXCEPTIONS = ("BaseException", "Exception")
BUILTINS_NAME = builtins.__name__

MSGS = {
Expand Down
6 changes: 6 additions & 0 deletions pylint/test/functional/broad_except.py
Expand Up @@ -6,3 +6,9 @@
__revision__ += 1
except Exception: # [broad-except]
print('error')


try:
__revision__ += 1
except BaseException: # [broad-except]
print('error')
3 changes: 2 additions & 1 deletion pylint/test/functional/broad_except.txt
@@ -1 +1,2 @@
broad-except:7::Catching too general exception Exception
broad-except:7::Catching too general exception Exception
broad-except:13::Catching too general exception BaseException

0 comments on commit 612b87a

Please sign in to comment.