You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was surprised bugbear didn't report this, but not encountered in live code so I don't know if it's seen much / ever in the wild:
try:
...
exceptBaseException:
...
except:
...
will report B001/E722, but in a project that uses bare excepts widely and disables those checks the except never being possible to run seems like a separate error.
or similar variants. Checking whether a caught exception is a built-in, and if so issubclass of a previously caught exception, seems straightforward. I quickly checked mypy and vulture as well and neither of them sees it. But this might definitely not be common enough that it's worth bothering with.
The text was updated successfully, but these errors were encountered:
For what it's worth, Pyright/Pylance catches this:
It does not catch bare except after a BaseException (and since py3 exceptions have to inherit from baseexception), but indeed looks like it catches the other ones.
If nothing catches Exception (and children) being caught/except after BaseException, I think this is worth a check. BaseException catching in general is even more evil than Exception and I generally won't approve PRs that do it ...
I also like it checks all other exceptions too, as not everyone runs VSCode / IDE with this detection.
Was surprised bugbear didn't report this, but not encountered in live code so I don't know if it's seen much / ever in the wild:
will report B001/E722, but in a project that uses bare excepts widely and disables those checks the except never being possible to run seems like a separate error.
Gives no warning, nor does a plausibly more common
or similar variants. Checking whether a caught exception is a built-in, and if so
issubclass
of a previously caught exception, seems straightforward. I quickly checked mypy and vulture as well and neither of them sees it. But this might definitely not be common enough that it's worth bothering with.The text was updated successfully, but these errors were encountered: