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-38858: Fix ref leak in pycore_interp_init() #17512

Merged
merged 1 commit into from
Dec 8, 2019
Merged

bpo-38858: Fix ref leak in pycore_interp_init() #17512

merged 1 commit into from
Dec 8, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Dec 8, 2019

bpo-38858, bpo-38997: _PySys_Create() returns a strong reference to
the sys module: Py_DECREF() is needed when we are done with the
module.

https://bugs.python.org/issue38858

@vstinner
Copy link
Member Author

vstinner commented Dec 8, 2019

I tested manually that this change fix https://bugs.python.org/issue38997:

$ ./python -m test -R 3:3 -j0  test__xxsubinterpreters test_atexit test_capi test_threading
(...)
All 4 tests OK.

Total duration: 1 min 2 sec
Tests result: SUCCESS

This bug is not a regression: it exists at least since Python 2.7. It's just that previously, the bug was hidden because subinterpreters were not well isolated from the main interpreter.

@ericsnowcurrently: Welcome to the hell of correctness enforced by subinterpreters :-)

bpo-38858, bpo-38997: _PySys_Create() returns a strong reference to
the sys module: Py_DECREF() is needed when we are done with the
module.
@vstinner
Copy link
Member Author

vstinner commented Dec 8, 2019

If this change is merged, PR #17509 can be rejected.

@vstinner vstinner merged commit 080ee5a into python:master Dec 8, 2019
@vstinner vstinner deleted the fix_sys_create branch December 8, 2019 20:56
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
bpo-38858, bpo-38997: _PySys_Create() returns a strong reference to
the sys module: Py_DECREF() is needed when we are done with the
module.
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.

3 participants