File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change <
8000
col width="44"/> 16
16
#include <ffi.h>
17
17
#include "ctypes.h"
18
18
19
+ #ifdef HAVE_ALLOCA_H
20
+ /* AIX needs alloca.h for alloca() */
21
+ #include <alloca.h>
22
+ #endif
23
+
19
24
/**************************************************************/
20
25
21
26
static void
@@ -155,20 +160,17 @@ static void _CallPythonObject(void *mem,
155
160
156
161
assert (PyTuple_Check (converters ));
157
162
nargs = PyTuple_GET_SIZE (converters );
158
- /* Hm. What to return in case of error?
159
- For COM, 0xFFFFFFFF seems better than 0.
160
- */
161
163
if (nargs < 0 ) {
162
164
PrintError ("BUG: PySequence_Length" );
163
165
goto Done ;
164
166
}
165
167
166
- PyObject * args_stack [CTYPES_MAX_ARGCOUNT ];
167
- if (nargs <= CTYPES_MAX_ARGCOUNT ) {
168
+ PyObject * args_stack [_PY_FASTCALL_SMALL_STACK ];
169
+ if (nargs <= _PY_FASTCALL_SMALL_STACK ) {
168
170
args = args_stack ;
169
171
}
170
172
else {
171
- args = PyMem_Malloc (nargs * sizeof (PyObject * ));
173
+ args = ( PyObject * * ) alloca (nargs * sizeof (PyObject * ));
172
174
if (args == NULL ) {
173
175
PyErr_NoMemory ();
174
176
goto Done ;
@@ -309,9 +311,6 @@ static void _CallPythonObject(void *mem,
309
311
for (j = 0 ; j < i ; j ++ ) {
310
312
Py_DECREF (args [j ]);
311
313
}
312
- if (args != args_stack ) {
313
- PyMem_Free (args );
314
- }
315
314
PyGILState_Release (state );
316
315
}
317
316
You can’t perform that action at this time.
0 commit comments