https://github.com/python/cpython/commit/5c06b34665c4538f7142a71ecc4cc4a0d82d2653
commit: 5c06b34665c4538f7142a71ecc4cc4a0d82d2653
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: gaogaotiantian <[email protected]>
date: 2024-06-28T16:17:51-07:00
summary:

[3.12] gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c 
(GH-121136) (#121140)

gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c 
(GH-121136)

PyObject_GetAttr returns a new reference, but this reference is never 
decremented using Py_DECREF, so Py_DECREF calls to this referece are added
(cherry picked from commit 92893fd8dc803ed7cdde55d29d25f84ccb5e3ef0)

Co-authored-by: Justin Applegate <[email protected]>

files:
M Modules/_pickle.c

diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 2bf9977f0b7795..52e9e6b4b66104 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -6623,11 +6623,13 @@ load_additems(PickleState *state, UnpicklerObject *self)
             if (result == NULL) {
                 Pdata_clear(self->stack, i + 1);
                 Py_SET_SIZE(self->stack, mark);
+                Py_DECREF(add_func);
                 return -1;
             }
             Py_DECREF(result);
         }
         Py_SET_SIZE(self->stack, mark);
+        Py_DECREF(add_func);
     }
 
     return 0;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to