Bug report
Bug description:
Parent: #146102
https://gist.github.com/devdanzin/b022ff2d1304a4b2b8d3d8750abd8da5
pylifecycle.c: Multiple init/fini cleanup bugs
Summary
5 bugs in interpreter lifecycle:
- new_interpreter (line 2534):
return status bypasses switch-back after save_tstate detach → thread state corruption.
- pycore_init_builtins (line 860): Direct
return leaks bimod ref.
- add_main_module (line 2762):
bimod/loader refs leaked on PyDict_SetItemString failure.
- finalize_clear_modules_dict (line 1685): Return value of
PyObject_CallMethodNoArgs never DECREF'd.
- init_sys_streams (line 3019-3031): Unchecked
PySys_SetObject for stdin/stdout (stderr correctly checked).
CPython versions tested on:
CPython main branch, 3.15
Operating systems tested on:
No response
Linked PRs
Bug report
Bug description:
Parent: #146102
https://gist.github.com/devdanzin/b022ff2d1304a4b2b8d3d8750abd8da5
pylifecycle.c: Multiple init/fini cleanup bugs
Summary
5 bugs in interpreter lifecycle:
return statusbypasses switch-back aftersave_tstatedetach → thread state corruption.returnleaksbimodref.bimod/loaderrefs leaked onPyDict_SetItemStringfailure.PyObject_CallMethodNoArgsnever DECREF'd.PySys_SetObjectfor stdin/stdout (stderr correctly checked).CPython versions tested on:
CPython main branch, 3.15
Operating systems tested on:
No response
Linked PRs