1.6 KiB
1.6 KiB
Bug report
Describe the bug
The recent refactor introduced a missing type safety and potential runtime error:
remove_ctxandadd_ctxlacked documentation, making their purpose unclear.get_send_file_max_agereturned a value without proper type casting, triggeringtype: ignorecomments.- The static file route used a lambda referencing a weakref; if the app was garbage‑collected it could raise an obscure error.
raise_routing_exceptionraisedrequest.routing_exceptionwithout guaranteeing it was notNone, leading to a possibleTypeError.
These issues manifested as type‑checking failures and potential crashes when serving static files or handling routing exceptions.
Steps to reproduce
- Run the test suite (
pytest). - Observe
type: ignorewarnings and potential failures intest_regression.pywhen static files are accessed. - Manually trigger a routing exception (e.g., abort with a redirect) and notice that
raise_routing_exceptionmay raiseNone. - Access a static file after the app has been garbage‑collected (unlikely in normal use but possible in long‑running processes).
Expected behavior
- Functions should have clear docstrings.
get_send_file_max_ageshould return anintorNonewith proper type casting.- The static file view should raise a clear
RuntimeErrorif the app is unavailable. raise_routing_exceptionshould assert the exception exists before raising.
Environment
- Python version: 3.12
- Flask version: 3.2.0.dev
This issue was created automatically using the repository's issue template.