mirror of
https://github.com/python/cpython.git
synced 2026-02-13 19:04:37 +00:00
gh-83004: Clean up refleak in _pickle initialisation (GH-98841)
(cherry picked from commit d3b82b4463)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
parent
4b1e45e78b
commit
57077928ec
2 changed files with 7 additions and 7 deletions
|
|
@ -0,0 +1 @@
|
|||
Clean up refleaks on failed module initialisation in in :mod:`_pickle`
|
||||
|
|
@ -7998,16 +7998,15 @@ PyInit__pickle(void)
|
|||
if (st->UnpicklingError == NULL)
|
||||
return NULL;
|
||||
|
||||
Py_INCREF(st->PickleError);
|
||||
if (PyModule_AddObject(m, "PickleError", st->PickleError) < 0)
|
||||
if (PyModule_AddObjectRef(m, "PickleError", st->PickleError) < 0) {
|
||||
return NULL;
|
||||
Py_INCREF(st->PicklingError);
|
||||
if (PyModule_AddObject(m, "PicklingError", st->PicklingError) < 0)
|
||||
}
|
||||
if (PyModule_AddObjectRef(m, "PicklingError", st->PicklingError) < 0) {
|
||||
return NULL;
|
||||
Py_INCREF(st->UnpicklingError);
|
||||
if (PyModule_AddObject(m, "UnpicklingError", st->UnpicklingError) < 0)
|
||||
}
|
||||
if (PyModule_AddObjectRef(m, "UnpicklingError", st->UnpicklingError) < 0) {
|
||||
return NULL;
|
||||
|
||||
}
|
||||
if (_Pickle_InitState(st) < 0)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue