| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Thanks for the review. I moved the regression test into the existing Lib/test/test_support.py test suite and removed the standalone test file. The test preserves the module-replacement scenario and restores the warning state afterwards. Verified with PCbuild/amd64/python_d.exe -m test test_support -v (72 tests passed, 4 skipped). |
Sorry, something went wrong.
|
The change does not add a new test helper: the regression is added to the existing Lib/test/test_support.py alongside the related check_warnings tests. The only new file is the standard Misc/NEWS.d entry required for the bug fix. Closing this clarification thread. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issue: #156570
Summary
warnings_helper._filterwarnings() indexed sys.modules['warnings'] directly. Under -X lazy_imports=all, evaluating the module-level import can leave that entry unresolved, causing check_warnings() to raise KeyError.
Use the already imported module as a fallback when the warnings entry is absent, and add regression coverage for this state.
Testing
Compatibility
The change preserves the existing module replacement behavior used by test_warnings while avoiding a KeyError when lazy imports have not populated sys.modules.
AI assistance was used to identify the issue and prepare this patch.
Fixes #156570