FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-46417: Debug tp_subclasses crash by vstinner · Pull Request #30791 · python/cpython · GitHub

/ cpython Public
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 5 additions & 2 deletions Objects/typeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -4138,7 +4138,7 @@ _PyType_GetSubclasses(PyTypeObject *self)
}

// Hold a strong reference to tp_subclasses while iterating on it
PyObject *dict = Py_XNewRef(self->tp_subclasses);
PyObject *dict = self->tp_subclasses;
if (dict == NULL) {
return list;
}
Expand All @@ -4159,7 +4159,6 @@ _PyType_GetSubclasses(PyTypeObject *self)
}
}
done:
Py_DECREF(dict);
return list;
}

Expand Down Expand Up @@ -6568,6 +6567,10 @@ remove_subclass(PyTypeObject *base, PyTypeObject *type)
PyErr_Clear();
}
Py_XDECREF(key);

if (PyDict_Size(dict) == 0) {
Py_CLEAR(base->tp_subclasses);
}
}

static void
Expand Down

Back | FazBrowse Home | New Git URL