Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea683de

Browse files
ZackerySpytzbenjaminp
authored andcommitted
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
An exception may occur during a PyObject_IsSubclass() call.
1 parent 954900a commit ea683de

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
@@ -1168,7 +1168,11 @@ PyCPointerType_from_param(PyObject *type, PyObject *value)
11681168
*/
11691169
StgDictObject *v = PyObject_stgdict(value);
11701170
assert(v); /* Cannot be NULL for pointer or array objects */
1171-
if (PyObject_IsSubclass(v->proto, typedict->proto)) {
1171+
int ret = PyObject_IsSubclass(v->proto, typedict->proto);
1172+
if (ret < 0) {
1173+
return NULL;
1174+
}
1175+
if (ret) {
11721176
Py_INCREF(value);
11731177
return value;
11741178
}

0 commit comments

Comments
 (0)