New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-46417: Finalize structseq types at exit #30645
Conversation
|
There are a few more structseq types:
|
|
I changed my mind and also enabled the code on Python release build. Previously, I only enabled the code if the Py_DEBUG macro was defined. For example, the Windows CI job on pull requests builds Python in release mode. If something is wrong, I prefer to catch the bug early and fix it. |
Add _PyStructSequence_FiniType() and _PyStaticType_Dealloc() functions to finalize a structseq static type in Py_Finalize(). Currrently, these functions do nothing if Python is built in release mode. Clear static types: * AsyncGenHooksType: sys.set_asyncgen_hooks() * FlagsType: sys.flags * FloatInfoType: sys.float_info * Hash_InfoType: sys.hash_info * Int_InfoType: sys.int_info * ThreadInfoType: sys.thread_info * UnraisableHookArgsType: sys.unraisablehook * VersionInfoType: sys.version * WindowsVersionType: sys.getwindowsversion()
|
The PR is now ready for a review :-) |
Do you mean to create a list of structseq types when _PyStructSequence_InitType() or _PyStructSequence_InitType2() is called? Yeah, I had this idea, but I am not sure about it. A problem is to control exactly when these types are deleted and types them in a specific order. The Python finalization is quite complex, see my notes about past issues: https://pythondev.readthedocs.io/finalization.html
|
Yes. That's what I mean : )
OK, Thanks for your information. I will study your notes. |
|
I enhanced the tests to check more PyTypeObject members. |
Add _PyStructSequence_FiniType() and _PyStaticType_Dealloc()
functions to finalize a structseq static type in Py_Finalize().
Currrently, these functions do nothing if Python is built in release
mode.
Clear static types:
https://bugs.python.org/issue46417