pallets / jinja

A very fast and expressive template engine.
https://jinja.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.6k forks source link

Flake8 error B036 reported by updated flake8-bugbear version #1941

Closed jayaddison closed 4 months ago

jayaddison commented 6 months ago

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.

Environment:

jayaddison commented 4 months ago

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