-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Open
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
sys.lazy_modules is now a dict[str, set[str]], not a flat set. There's some places in the stdlib code that incorrectly suggests the older invariant.
Most notable example:
cpython/Lib/test/test_import/test_lazy_imports.py
Lines 457 to 459 in 70da972
| def test_lazy_modules_attribute_is_set(self): | |
| """sys.lazy_modules should be a set per PEP 810.""" | |
| self.assertIsInstance(sys.lazy_modules, dict) |
The PEP needs updating as well -- https://peps.python.org/pep-0810/#lazy-import-mechanism -- @DinoV, I think this is something you were working on, or is it open for contrib?
I'm happy to pick this one up (i.e. fixing our code to reflect sys.lazy_modules is a dict) if you'd like that! (Please reassign otherwise.)
cc @pablogsal @DinoV @brittanyrey @Yhg1s
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error