diff options
author | Dong-hee Na <donghee.na@python.org> | 2022-02-10 10:10:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 10:10:07 (GMT) |
commit | db052851a70fd95d047c6263fc16a75e4d47b3ed (patch) | |
tree | 3b48d175df567b2f22d5747c017067f7a62bba18 | |
parent | dee020a6f5bf29f95bec6294da9bcd577114f592 (diff) | |
download | cpython-db052851a70fd95d047c6263fc16a75e4d47b3ed.zip cpython-db052851a70fd95d047c6263fc16a75e4d47b3ed.tar.gz cpython-db052851a70fd95d047c6263fc16a75e4d47b3ed.tar.bz2 |
bpo-46323: Allow alloca(0) for python callback function of ctypes (GH-31249)
-rw-r--r-- | Modules/_ctypes/callbacks.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 591b944..6037f5f 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -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 |