From ea683deccc505a78bbbb1eb8c6a88b0835ad5151 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Thu, 12 Sep 2019 04:09:32 -0600 Subject: [PATCH] closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011) An exception may occur during a PyObject_IsSubclass() call. --- Modules/_ctypes/_ctypes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index d2f6391fa6..16a0cfe8dd 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1168,7 +1168,11 @@ PyCPointerType_from_param(PyObject *type, PyObject *value) */ StgDictObject *v = PyObject_stgdict(value); assert(v); /* Cannot be NULL for pointer or array objects */ - if (PyObject_IsSubclass(v->proto, typedict->proto)) { + int ret = PyObject_IsSubclass(v->proto, typedict->proto); + if (ret < 0) { + return NULL; + } + if (ret) { Py_INCREF(value); return value; } -- 2.40.0