from ctypes import *
from ctypes.test import need_symbol
+from _ctypes import CTYPES_MAX_ARGCOUNT
import _ctypes_test
class Callbacks(unittest.TestCase):
def func(*args):
return len(args)
- CTYPES_MAX_ARGCOUNT = 1024
-
# valid call with nargs <= CTYPES_MAX_ARGCOUNT
proto = CFUNCTYPE(c_int, *(c_int,) * CTYPES_MAX_ARGCOUNT)
cb = proto(func)
--- /dev/null
+Allow vendors to override :const:`CTYPES_MAX_ARGCOUNT`.
#endif
MOD_ADD("RTLD_LOCAL", PyLong_FromLong(RTLD_LOCAL));
MOD_ADD("RTLD_GLOBAL", PyLong_FromLong(RTLD_GLOBAL));
+ MOD_ADD("CTYPES_MAX_ARGCOUNT", PyLong_FromLong(CTYPES_MAX_ARGCOUNT));
MOD_ADD("ArgumentError", Py_NewRef(PyExc_ArgError));
return 0;
#undef MOD_ADD
* This limit is enforced for the `alloca()` call in `_ctypes_callproc`,
* to avoid allocating a massive buffer on the stack.
*/
-#define CTYPES_MAX_ARGCOUNT 1024
+#ifndef CTYPES_MAX_ARGCOUNT
+ #define CTYPES_MAX_ARGCOUNT 1024
+#endif
typedef struct tagPyCArgObject PyCArgObject;
typedef struct tagCDataObject CDataObject;