diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index b38e0fb..ca5355a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3768,8 +3768,10 @@ _PyObject_GetState(PyObject *obj) PyObject *name, *value; name = PyList_GET_ITEM(slotnames, i); + Py_INCREF(name); value = PyObject_GetAttr(obj, name); if (value == NULL) { + Py_DECREF(name); if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { goto error; } @@ -3778,6 +3780,7 @@ _PyObject_GetState(PyObject *obj) } else { int err = PyDict_SetItem(slots, name, value); + Py_DECREF(name); Py_DECREF(value); if (err) { goto error; |