FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-30860: Fix a refleak. by ericsnowcurrently · Pull Request #3506 · python/cpython · GitHub

/ cpython Public

bpo-30860: Fix a refleak. - #3506

Merged
vstinner merged 6 commits into
python:masterfrom
ericsnowcurrently:fix-31420
Sep 12, 2017
Merged

bpo-30860: Fix a refleak.#3506
vstinner merged 6 commits into
python:masterfrom
ericsnowcurrently:fix-31420

Conversation

ericsnowcurrently commented Sep 11, 2017
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member

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:

    xoptions = PySys_GetXOptions();
    if (xoptions == NULL)
        return;
    value = _PyDict_GetItemId(xoptions, &PyId_showrefcount);
    if (value == Py_True)

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If you use #ifdef Py_REF_DEBUG, maybe _PY_DEBUG_PRINT_TOTAL_REFS() macro can go away.

Copy link
Copy Markdown
Member Author

Yeah, that's what I did.

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ah yes, you removed the macro. Nice.

LGTM.

vstinner merged commit 8728018 into python:master Sep 12, 2017
ericsnowcurrently deleted the fix-31420 branch September 12, 2017 01:00
ericsnowcurrently added a commit to ericsnowcurrently/cpython that referenced this pull request Sep 14, 2017
ericsnowcurrently restored the fix-31420 branch September 14, 2017 06:26
ericsnowcurrently deleted the fix-31420 branch September 14, 2017 06:30
ericsnowcurrently added a commit that referenced this pull request Sep 14, 2017
…3565)

PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
ericsnowcurrently restored the fix-31420 branch September 14, 2017 07:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL