-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
types.LazyImportType is not initialized #145452
Copy link
Copy link
Closed
Labels
3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Bug description:
At runtime,
types.LazyImportTypeis an uninitialized static type (unless you e.g. accesstypes.LazyImportType.resolvefirst).This can lead to funky behaviors:
The solution I found is to add
&PyLazyImport_Typetostatic_types[], the array of types initialized in_PyTypes_InitTypesduring interpreter startup.CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
PyLazyImport_Typeduring interpreter startup #145453