mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
An exception may occur during a PyObject_IsSubclass() call.
This commit is contained in:
parent
954900a3f9
commit
ea683deccc
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue