mirror of
https://github.com/python/cpython.git
synced 2024-11-27 20:04:41 +08:00
gh-83004: Clean up refleak in _pickle initialisation (#98841)
This commit is contained in:
parent
31f2f6568d
commit
d3b82b4463
@ -0,0 +1 @@
|
|||||||
|
Clean up refleaks on failed module initialisation in in :mod:`_pickle`
|
@ -7986,16 +7986,15 @@ PyInit__pickle(void)
|
|||||||
if (st->UnpicklingError == NULL)
|
if (st->UnpicklingError == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Py_INCREF(st->PickleError);
|
if (PyModule_AddObjectRef(m, "PickleError", st->PickleError) < 0) {
|
||||||
if (PyModule_AddObject(m, "PickleError", st->PickleError) < 0)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_INCREF(st->PicklingError);
|
}
|
||||||
if (PyModule_AddObject(m, "PicklingError", st->PicklingError) < 0)
|
if (PyModule_AddObjectRef(m, "PicklingError", st->PicklingError) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_INCREF(st->UnpicklingError);
|
}
|
||||||
if (PyModule_AddObject(m, "UnpicklingError", st->UnpicklingError) < 0)
|
if (PyModule_AddObjectRef(m, "UnpicklingError", st->UnpicklingError) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
if (_Pickle_InitState(st) < 0)
|
if (_Pickle_InitState(st) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user