gh-106023: Remove _PY_FASTCALL_SMALL_STACK constant (#106258)

Remove _PY_FASTCALL_SMALL_STACK constant from the C API: move it to
the internal C API (pycore_call.h).
This commit is contained in:
Victor Stinner 2023-06-30 03:07:59 +02:00 committed by GitHub
parent 8c5f74fc89
commit cd580910e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 13 deletions

View File

@ -2,19 +2,6 @@
# error "this header file must not be included directly" # error "this header file must not be included directly"
#endif #endif
/* === Object Protocol ================================================== */
/* 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_Vectorcall() 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
/* === Vectorcall protocol (PEP 590) ============================= */ /* === Vectorcall protocol (PEP 590) ============================= */
// PyVectorcall_NARGS() is exported as a function for the stable ABI. // PyVectorcall_NARGS() is exported as a function for the stable ABI.

View File

@ -10,6 +10,18 @@ extern "C" {
#include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_pystate.h" // _PyThreadState_GET()
/* 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_Vectorcall() 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
// Export for shared stdlib extensions like the math extension, // Export for shared stdlib extensions like the math extension,
// function used via inlined _PyObject_VectorcallTstate() function. // function used via inlined _PyObject_VectorcallTstate() function.
PyAPI_FUNC(PyObject*) _Py_CheckFunctionResult( PyAPI_FUNC(PyObject*) _Py_CheckFunctionResult(