bpo-46323: Allow alloca(0) for python callback function of ctypes (GH-31249)
This commit is contained in:
parent
dee020a6f5
commit
db052851a7
@ -165,11 +165,7 @@ static void _CallPythonObject(void *mem,
|
|||||||
assert(PyTuple_Check(converters));
|
assert(PyTuple_Check(converters));
|
||||||
nargs = PyTuple_GET_SIZE(converters);
|
nargs = PyTuple_GET_SIZE(converters);
|
||||||
assert(nargs <= CTYPES_MAX_ARGCOUNT);
|
assert(nargs <= CTYPES_MAX_ARGCOUNT);
|
||||||
PyObject **args = NULL;
|
PyObject **args = alloca(nargs * sizeof(PyObject *));
|
||||||
if (nargs > 0) {
|
|
||||||
args = alloca(nargs * sizeof(PyObject *));
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject **cnvs = PySequence_Fast_ITEMS(converters);
|
PyObject **cnvs = PySequence_Fast_ITEMS(converters);
|
||||||
for (i = 0; i < nargs; i++) {
|
for (i = 0; i < nargs; i++) {
|
||||||
PyObject *cnv = cnvs[i]; // borrowed ref
|
PyObject *cnv = cnvs[i]; // borrowed ref
|
||||||
|
Loading…
x
Reference in New Issue
Block a user