mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid __subclasses__ (GH-8835)
The missing NULL check was reported by Svace static analyzer.
This commit is contained in:
parent
4c8555773a
commit
cdbf50cba1
3 changed files with 36 additions and 0 deletions
|
@ -665,6 +665,9 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
|
|||
|
||||
/* 6. Check if it's a subclass of a subclass (recursive). */
|
||||
subclasses = PyObject_CallMethod(self, "__subclasses__", NULL);
|
||||
if (subclasses == NULL) {
|
||||
goto end;
|
||||
}
|
||||
if (!PyList_Check(subclasses)) {
|
||||
PyErr_SetString(PyExc_TypeError, "__subclasses__() must return a list");
|
||||
goto end;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue