-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-30860: Fix a refleak. #3506
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
In Py_Main(), read_command_line() is called after _Py_InitializeCore, so after the interpreter had been already created and after the sys module has been initialized.
For example, in Python 3.5, Py_Initialize() was only called after the command line has been parsed.
It seems like past changes now make this change possible and correct.
Oh, test_showrefcount() of test_cmd_line fails. You have to check sys._xoptions['showrefcount'] before calling _PyDebug_PrintTotalRefs(). Move the following _PyDebug_PrintTotalRefs() code:
in Py_FinalizeEx(), before _PyImport_Fini(). Since _PyDebug_PrintTotalRefs() is private, it's ok to rewrite it to move the test into the caller. But you have to take care of "#ifdef Py_REF_DEBUG". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use #ifdef Py_REF_DEBUG, maybe _PY_DEBUG_PRINT_TOTAL_REFS() macro can go away.
Yeah, that's what I did. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, you removed the macro. Nice.
LGTM.
This reverts commit 8728018.
Resolves bpo-31420.
https://bugs.python.org/issue30860