Recent versions of flake8-bugbear have added an error class of B036:
B036: Found except BaseException: without re-raising (no raise in the top-level of the except block). This catches all kinds of things (Exception, SystemExit, KeyboardInterrupt...) and may prevent a program from exiting as expected.
This currently flags two exception handlers in the jinja codebase.
The issue is replicable from commit 3fd91e4d11bdd131d8c12805177dbe74d85e7b82 with flake8==7.0.0 and flake8-bugbear==24.2.6 by running flake8 src tests from the commandline:
$ flake8 src tests
src/jinja2/debug.py:146:5: B036 Don't except `BaseException` unless you plan to re-raise it.
tests/test_loader.py:258:9: B036 Don't except `BaseException` unless you plan to re-raise it.
$ echo $?
1
Linting with flake8, as used during continuous integration via GitHub Actions, is expected to encounter no errors on the codebase and exit with code zero.
Recent versions of
flake8-bugbear
have added an error class ofB036
:This currently flags two exception handlers in the
jinja
codebase.The issue is replicable from commit 3fd91e4d11bdd131d8c12805177dbe74d85e7b82 with
flake8==7.0.0
andflake8-bugbear==24.2.6
by runningflake8 src tests
from the commandline:Linting with
flake8
, as used during continuous integration via GitHub Actions, is expected to encounter no errors on the codebase and exit with code zero.Environment: