diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-12 10:28:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-12 10:28:05 (GMT) |
commit | 79cbaf50ac9530d507149402de5c84fa590d9cfb (patch) | |
tree | e22fba215c9ad64f8260d86f79851c9f3fc407e1 /Modules | |
parent | 3562ae25402aad36583bc27d4d82c67554323d5e (diff) | |
download | cpython-79cbaf50ac9530d507149402de5c84fa590d9cfb.zip cpython-79cbaf50ac9530d507149402de5c84fa590d9cfb.tar.gz cpython-79cbaf50ac9530d507149402de5c84fa590d9cfb.tar.bz2 |
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 ea683deccc505a78bbbb1eb8c6a88b0835ad5151)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules')
-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 4728874..0f11e01 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; } |