Message376991
One underlying issue from bpo-41631 is that importlib.util.LazyLoader produces modules that are only fully loaded after an attribute is accessed (through __getattribute__).
C-API functions like PyModule_GetState, PyModule_GetDict and such do not get attributes, and when called on a _LazyModule, they might try to access uninitialized C-level state.
I see two possible ways to fix this:
- Make PyModule_GetState, etc. trigger a full load. Since this is C-API, it would need a fast (no Python code) way either to do the full load or to detect _LazyModule.
- Make LazyLoader eager for either all extension & builtin modules, or for modules that have C-level storage. The latter would need a way to pass info from PyModuleDef to the loader.
Brett, does that analysis make sense from the importlib POV? |
|
Date |
User |
Action |
Args |
2020-09-16 13:23:38 | petr.viktorin | set | recipients:
+ petr.viktorin, brett.cannon |
2020-09-16 13:23:38 | petr.viktorin | set | messageid: <1600262618.31.0.325694341017.issue41797@roundup.psfhosted.org> |
2020-09-16 13:23:38 | petr.viktorin | link | issue41797 messages |
2020-09-16 13:23:38 | petr.viktorin | create | |
|