diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-09-12 10:09:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2019-09-12 10:09:32 (GMT) |
commit | ea683deccc505a78bbbb1eb8c6a88b0835ad5151 (patch) | |
tree | d56dadd7c576988c08b3fe763b84ffa77c4ae40f /Modules/_ctypes | |
parent | 954900a3f98a8c0dea14dd575490237f3f8626b3 (diff) | |
download | cpython-ea683deccc505a78bbbb1eb8c6a88b0835ad5151.zip cpython-ea683deccc505a78bbbb1eb8c6a88b0835ad5151.tar.gz cpython-ea683deccc505a78bbbb1eb8c6a88b0835ad5151.tar.bz2 |
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
An exception may occur during a PyObject_IsSubclass() call.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index d2f6391..16a0cfe 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; } |