Skip to content

Commit

Permalink
gh-104454: Fix refleak in AttributeError_reduce (#104455)
Browse files Browse the repository at this point in the history
* Fix the reference leak introduced by #103333

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
  • Loading branch information
csm10495 and Eclips4 authored May 13, 2023
1 parent 46f1c78 commit 7d2deaf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down

0 comments on commit 7d2deaf

Please sign in to comment.