[Python-checkins] bpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)
corona10
webhook-mailer at python.org
Tue Feb 8 00:22:38 EST 2022
https://github.com/python/cpython/commit/e959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d
commit: e959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d
branch: main
author: Dong-hee Na <donghee.na at python.org>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-02-08T14:22:13+09:00
summary:
bpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)
files:
M Modules/_ctypes/_ctypes.c
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index da9dd096c73d8..15eb7521baa1c 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2392,6 +2392,7 @@ converters_from_argtypes(PyObject *ob)
Py_ssize_t nArgs = PyTuple_GET_SIZE(ob);
if (nArgs > CTYPES_MAX_ARGCOUNT) {
+ Py_DECREF(ob);
PyErr_Format(PyExc_ArgError,
"_argtypes_ has too many arguments (%zi), maximum is %i",
nArgs, CTYPES_MAX_ARGCOUNT);
More information about the Python-checkins
mailing list