bpo-38858: Fix ref leak in pycore_interp_init() by vstinner · Pull Request #17512 · python/cpython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation2 Commits1 Checks0 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
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.
If this change is merged, PR #17509 can be rejected.
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request
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.