Skip to content

Commit e959dd9

Browse files
authored
bpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)
1 parent da576e0 commit e959dd9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,6 +2392,7 @@ converters_from_argtypes(PyObject *ob)
23922392

23932393
Py_ssize_t nArgs = PyTuple_GET_SIZE(ob);
23942394
if (nArgs > CTYPES_MAX_ARGCOUNT) {
2395+
Py_DECREF(ob);
23952396
PyErr_Format(PyExc_ArgError,
23962397
"_argtypes_ has too many arguments (%zi), maximum is %i",
23972398
nArgs, CTYPES_MAX_ARGCOUNT);

0 commit comments

Comments
 (0)