summaryrefslogtreecommitdiffstats
path: root/Modules/_abc.c
diff options
context:
space:
mode:
authorAlexey Izbyshev <izbyshev@ispras.ru>2018-08-20 20:04:19 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2018-08-20 20:04:19 (GMT)
commitcdbf50cba1664f72ae6621a89c324a32fea70377 (patch)
treefd5bb4fe8e06f467a05a704f214be8b9a904d1db /Modules/_abc.c
parent4c8555773a801f957297132a92c0acb382d640e4 (diff)
downloadcpython-cdbf50cba1664f72ae6621a89c324a32fea70377.zip
cpython-cdbf50cba1664f72ae6621a89c324a32fea70377.tar.gz
cpython-cdbf50cba1664f72ae6621a89c324a32fea70377.tar.bz2
bpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid __subclasses__ (GH-8835)
The missing NULL check was reported by Svace static analyzer.
Diffstat (limited to 'Modules/_abc.c')
-rw-r--r--Modules/_abc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_abc.c b/Modules/_abc.c
index 562a2e6..ce9140f 100644
--- a/Modules/_abc.c
+++ b/Modules/_abc.c
@@ -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;