Skip to content

Commit 7d2deaf

Browse files
csm10495Eclips4
andauthored
gh-104454: Fix refleak in AttributeError_reduce (#104455)
* Fix the reference leak introduced by #103333 Co-authored-by: Kirill Podoprigora <[email protected]>
1 parent 46f1c78 commit 7d2deaf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/exceptions.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,9 @@ AttributeError_reduce(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignored)
23242324
return NULL;
23252325
}
23262326

2327-
return PyTuple_Pack(3, Py_TYPE(self), self->args, state);
2327+
PyObject *return_value = PyTuple_Pack(3, Py_TYPE(self), self->args, state);
2328+
Py_DECREF(state);
2329+
return return_value;
23282330
}
23292331

23302332
static PyMemberDef AttributeError_members[] = {

0 commit comments

Comments
 (0)