bpo-46323: Allow alloca(0) for python callback function of ctypes (GH-31249)

This commit is contained in:
Dong-hee Na 2022-02-10 19:10:07 +09:00 committed by GitHub
parent dee020a6f5
commit db052851a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -165,11 +165,7 @@ static void _CallPythonObject(void *mem,
assert(PyTuple_Check(converters));
nargs = PyTuple_GET_SIZE(converters);
assert(nargs <= CTYPES_MAX_ARGCOUNT);
PyObject **args = NULL;
if (nargs > 0) {
args = alloca(nargs * sizeof(PyObject *));
}
PyObject **args = alloca(nargs * sizeof(PyObject *));
PyObject **cnvs = PySequence_Fast_ITEMS(converters);
for (i = 0; i < nargs; i++) {
PyObject *cnv = cnvs[i]; // borrowed ref