summaryrefslogtreecommitdiff
path: root/Include/abstract.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-12-15 12:40:53 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-12-15 12:40:53 +0100
commitbc08ab4598ef05705fd1172f8be8f47307af96c1 (patch)
tree36d362e23b74d8516d8c5f9001b3966e1c440626 /Include/abstract.h
parentd1e35dd9ee50adf2c69445893ce4e5576b983091 (diff)
downloadcpython-git-bc08ab4598ef05705fd1172f8be8f47307af96c1.tar.gz
Add _PY_FASTCALL_SMALL_STACK constant
Issue #28870: Add a new _PY_FASTCALL_SMALL_STACK constant, size of "small stacks" allocated on the C stack to pass positional arguments to _PyObject_FastCall(). _PyObject_Call_Prepend() now uses a small stack of 5 arguments (40 bytes) instead of 8 (64 bytes), since it is modified to use _PY_FASTCALL_SMALL_STACK.
Diffstat (limited to 'Include/abstract.h')
-rw-r--r--Include/abstract.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 8c1e45bb26..f6dfc67585 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -303,6 +303,17 @@ PyAPI_FUNC(PyObject **) _PyStack_UnpackDict(
PyObject **kwnames,
PyObject *func);
+/* Suggested size (number of positional arguments) for arrays of PyObject*
+ allocated on a C stack to avoid allocating memory on the heap memory. Such
+ array is used to pass positional arguments to call functions of the
+ _PyObject_FastCall() family.
+
+ The size is chosen to not abuse the C stack and so limit the risk of stack
+ overflow. The size is also chosen to allow using the small stack for most
+ function calls of the Python standard library. On 64-bit CPU, it allocates
+ 40 bytes on the stack. */
+#define _PY_FASTCALL_SMALL_STACK 5
+
/* Call the callable object 'callable' with the "fast call" calling convention:
args is a C array for positional arguments (nargs is the number of
positional arguments), kwargs is a dictionary for keyword arguments.