summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2022-02-08 05:22:13 (GMT)
committerGitHub <noreply@github.com>2022-02-08 05:22:13 (GMT)
commite959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d (patch)
tree8a7c768142e32940a754f655e53cd239ed8e4f85
parentda576e08296490e94924421af71001bcfbccb317 (diff)
downloadcpython-e959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d.zip
cpython-e959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d.tar.gz
cpython-e959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d.tar.bz2
bpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)
-rw-r--r--Modules/_ctypes/_ctypes.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index da9dd09..15eb752 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);