bpo-36333: Fix leaks in pymain_init and _PyPreConfig_ReadFromArgv#12389
bpo-36333: Fix leaks in pymain_init and _PyPreConfig_ReadFromArgv#12389matrixise wants to merge 1 commit intopython:masterfrom
Conversation
|
|
||
| if (runtime->xidregistry.mutex != NULL) { | ||
| PyThread_free_lock(runtime->xidregistry.mutex); | ||
| runtime->xidregistry.mutex = NULL; |
There was a problem hiding this comment.
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.
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.
Oops, I missed that in the big refactoring I did last ones. Nicely spotted ;-)
There was a problem hiding this comment.
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.
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