summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 52704b0..80bb212 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -7986,16 +7986,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;