mirror of https://github.com/python/cpython.git
bpo-46323 Fix ref leak if ctypes.CFuncPtr raises an error. (GH-31209)
This commit is contained in:
parent
da576e0829
commit
e959dd9f5c
|
@ -2392,6 +2392,7 @@ converters_from_argtypes(PyObject *ob)
|
||||||
|
|
||||||
Py_ssize_t nArgs = PyTuple_GET_SIZE(ob);
|
Py_ssize_t nArgs = PyTuple_GET_SIZE(ob);
|
||||||
if (nArgs > CTYPES_MAX_ARGCOUNT) {
|
if (nArgs > CTYPES_MAX_ARGCOUNT) {
|
||||||
|
Py_DECREF(ob);
|
||||||
PyErr_Format(PyExc_ArgError,
|
PyErr_Format(PyExc_ArgError,
|
||||||
"_argtypes_ has too many arguments (%zi), maximum is %i",
|
"_argtypes_ has too many arguments (%zi), maximum is %i",
|
||||||
nArgs, CTYPES_MAX_ARGCOUNT);
|
nArgs, CTYPES_MAX_ARGCOUNT);
|
||||||
|
|
Loading…
Reference in New Issue