Skip to content

Commit

Permalink
pythonGH-93990: fix refcounting bug in add_subclass in `typeobject.…
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Jun 19, 2022
1 parent f21b071 commit c636432
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6400,8 +6400,11 @@ add_subclass(PyTypeObject *base, PyTypeObject *type)
PyObject *dict = base->tp_subclasses;
if (dict == NULL) {
base->tp_subclasses = dict = PyDict_New();
if (dict == NULL)
if (dict == NULL) {
Py_DECREF(key);
Py_DECREF(ref);
return -1;
}
}
assert(PyDict_CheckExact(dict));

Expand Down

0 comments on commit c636432

Please sign in to comment.