[Python-checkins] closes bpo-38127: _ctypes: PyObject_IsSubclass() should be checked for failure. (GH-16011)

Miss Islington (bot) webhook-mailer at python.org
Thu Sep 12 06:28:09 EDT 2019


https://github.com/python/cpython/commit/79cbaf50ac9530d507149402de5c84fa590d9cfb
commit: 79cbaf50ac9530d507149402de5c84fa590d9cfb
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019年09月12日T03:28:05-07:00
summary:
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 at gmail.com>
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 47288740063e..0f11e01e1110 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

AltStyle によって変換されたページ (->オリジナル) /