summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-04-04 17:13:42 (GMT)
committerGitHub <noreply@github.com>2022-04-04 17:13:42 (GMT)
commitd1b1c885d8f276a0b1ff2e327270916396a8b842 (patch)
tree3b2a0ea24178ca47ee87d10563141ba5e8e0cbe0 /Modules
parent1ecfe3d5ae4ddec4e73a6cfc93fed6df43fe0be5 (diff)
downloadcpython-d1b1c885d8f276a0b1ff2e327270916396a8b842.zip
cpython-d1b1c885d8f276a0b1ff2e327270916396a8b842.tar.gz
cpython-d1b1c885d8f276a0b1ff2e327270916396a8b842.tar.bz2
bpo-47208: Allow vendors to override CTYPES_MAX_ARGCOUNT (GH-32297)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c1
-rw-r--r--Modules/_ctypes/ctypes.h4
2 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 9177225..0415923 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -5781,6 +5781,7 @@ _ctypes_add_objects(PyObject *mod)
#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
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index 0badb48..da1941c 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -18,7 +18,9 @@
* 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;