[Python-checkins] closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
Benjamin Peterson
webhook-mailer at python.org
Thu Sep 12 06:09:36 EDT 2019
https://github.com/python/cpython/commit/ea683deccc505a78bbbb1eb8c6a88b0835ad5151
commit: ea683deccc505a78bbbb1eb8c6a88b0835ad5151
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Benjamin Peterson <benjamin at python.org>
date: 2019-09-12T11:09:32+01:00
summary:
closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)
An exception may occur during a PyObject_IsSubclass() call.
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index d2f6391fa6db..16a0cfe8dd4d 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;
}
More information about the Python-checkins
mailing list