Conversation
vstinner
left a comment
There was a problem hiding this comment.
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". |
vstinner
left a comment
There was a problem hiding this comment.
If you use #ifdef Py_REF_DEBUG, maybe _PY_DEBUG_PRINT_TOTAL_REFS() macro can go away.
|
Yeah, that's what I did. |
vstinner
left a comment
There was a problem hiding this comment.
Ah yes, you removed the macro. Nice.
LGTM.
This reverts commit 8728018.
Resolves bpo-31420.
https://bugs.python.org/issue30860