Skip to content

Commit 197ac1a

Browse files
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
An exception may occur during a PyObject_IsSubclass() call. (cherry picked from commit ea683de) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent ff2a5c0 commit 197ac1a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,11 @@ PyCPointerType_from_param(PyObject *type, PyObject *value)
10941094
*/
10951095
StgDictObject *v = PyObject_stgdict(value);
10961096
assert(v); /* Cannot be NULL for pointer or array objects */
1097-
if (PyObject_IsSubclass(v->proto, typedict->proto)) {
1097+
int ret = PyObject_IsSubclass(v->proto, typedict->proto);
1098+
if (ret < 0) {
1099+
return NULL;
1100+
}
1101+
if (ret) {
10981102
Py_INCREF(value);
10991103
return value;
11001104
}

0 commit comments

Comments
 (0)