-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-36333: Fix leaks in pymain_init and _PyPreConfig_ReadFromArgv #12389
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
Conversation
|
|
||
| if (runtime->xidregistry.mutex != NULL) { | ||
| PyThread_free_lock(runtime->xidregistry.mutex); | ||
| runtime->xidregistry.mutex = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write a separated PR to this change. I don't know well this code, so I'm not sure how xidregistry is supposed to be used.
vstinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, I think that I will rewrite your PR because I'm in the middle of a big refactoring, and the correct fix for your bug requires more fixes.
But please write a separated PR for _PyRuntimeState_Fini.
| done: | ||
| if (init_ctype_locale != NULL) { | ||
| setlocale(LC_CTYPE, init_ctype_locale); | ||
| PyMem_RawFree(init_ctype_locale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I missed that in the big refactoring I did last ones. Nicely spotted ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a similar leak in _PyPreConfig_Read, btharper@81e617d I didn't see any more cases grepping for setlocale calls
|
|
||
| err = config_read_write(config, args, preconfig); | ||
| if (_Py_INIT_FAILED(err)) { | ||
| _PyRuntimeState_Fini(&_PyRuntime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not the right place to cleanup things. I redesigned deeply Py_Main() to replace exit() call in mutliple layers of function calls, far from Py_Main(), with _PyInitError which allows to give back the control flow to Py_Main(). I did that to be able to cleanup Python properly.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
https://bugs.python.org/issue36333