Skip to content
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-46857: Fix refleak in OSError INIT_ALIAS() #31594

Merged
merged 2 commits into from Feb 26, 2022
Merged

bpo-46857: Fix refleak in OSError INIT_ALIAS() #31594

merged 2 commits into from Feb 26, 2022

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Feb 26, 2022

_Py_GetRefTotal() no longer decrements _PySet_Dummy refcount.

https://bugs.python.org/issue46857

_Py_GetRefTotal() no longer decrements _PySet_Dummy refcount.
Copy link
Contributor

@jkloth jkloth left a comment

Choose a reason for hiding this comment

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

Seems to work, although do not forget to test with buildbots!

if (o != NULL)
total -= Py_REFCNT(o);
return total;
return _Py_RefTotal;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is no longer needed, more the better, but I haven't been testing this change

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, this is the change that makes total refs 0!

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, this is the change that makes total refs 0!

Without this change, _Py_GetRefTotal() returns -2 when the Python process is started, before calling Py_Initialiaze() (ex: if you put a breakpoint on the main() function).

@vstinner vstinner merged commit ad56919 into python:main Feb 26, 2022
@vstinner vstinner deleted the oserror_alias_refleak branch February 26, 2022 23:28
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.

None yet

4 participants