diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 59c63f4aa44958..a8d4e3a696ce8e 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2324,7 +2324,9 @@ AttributeError_reduce(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignored) return NULL; } - return PyTuple_Pack(3, Py_TYPE(self), self->args, state); + PyObject *return_value = PyTuple_Pack(3, Py_TYPE(self), self->args, state); + Py_DECREF(state); + return return_value; } static PyMemberDef AttributeError_members[] = {