Skip to content

Commit db05285

Browse files
authored
bpo-46323: Allow alloca(0) for python callback function of ctypes (GH-31249)
1 parent dee020a commit db05285

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Modules/_ctypes/callbacks.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,7 @@ static void _CallPythonObject(void *mem,
165165
assert(PyTuple_Check(converters));
166166
nargs = PyTuple_GET_SIZE(converters);
167167
assert(nargs <= CTYPES_MAX_ARGCOUNT);
168-
PyObject **args = NULL;
169-
if (nargs > 0) {
170-
args = alloca(nargs * sizeof(PyObject *));
171-
}
172-
168+
PyObject **args = alloca(nargs * sizeof(PyObject *));
173169
PyObject **cnvs = PySequence_Fast_ITEMS(converters);
174170
for (i = 0; i < nargs; i++) {
175171
PyObject *cnv = cnvs[i]; // borrowed ref

0 commit comments

Comments
 (0)