pallets/jinja

Flake8 error B036 reported by updated flake8-bugbear version

jayaddison opened this issue · 1 comments

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 3fd91e4 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.

Environment:

  • Python version: 3.11.8
  • Jinja version: 3.2.0.dev0 (3fd91e4)

flake8-bugbear has been removed from the pre-commit lint checks (ref: #1968), and as a result this can be closed (wontfix).