mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-127705: Use _PyStackRef
s in the default build. (GH-127875)
This commit is contained in:
parent
7cc99a54b7
commit
2bef8ea8ea
21 changed files with 688 additions and 254 deletions
|
@ -440,28 +440,13 @@ do { \
|
|||
/* How much scratch space to give stackref to PyObject* conversion. */
|
||||
#define MAX_STACKREF_SCRATCH 10
|
||||
|
||||
#if defined(Py_GIL_DISABLED) || defined(Py_STACKREF_DEBUG)
|
||||
#define STACKREFS_TO_PYOBJECTS(ARGS, ARG_COUNT, NAME) \
|
||||
/* +1 because vectorcall might use -1 to write self */ \
|
||||
PyObject *NAME##_temp[MAX_STACKREF_SCRATCH+1]; \
|
||||
PyObject **NAME = _PyObjectArray_FromStackRefArray(ARGS, ARG_COUNT, NAME##_temp + 1);
|
||||
#else
|
||||
#define STACKREFS_TO_PYOBJECTS(ARGS, ARG_COUNT, NAME) \
|
||||
PyObject **NAME = (PyObject **)ARGS; \
|
||||
assert(NAME != NULL);
|
||||
#endif
|
||||
|
||||
#if defined(Py_GIL_DISABLED) || defined(Py_STACKREF_DEBUG)
|
||||
#define STACKREFS_TO_PYOBJECTS_CLEANUP(NAME) \
|
||||
/* +1 because we +1 previously */ \
|
||||
_PyObjectArray_Free(NAME - 1, NAME##_temp);
|
||||
#else
|
||||
#define STACKREFS_TO_PYOBJECTS_CLEANUP(NAME) \
|
||||
(void)(NAME);
|
||||
#endif
|
||||
|
||||
#if defined(Py_GIL_DISABLED) || defined(Py_STACKREF_DEBUG)
|
||||
#define CONVERSION_FAILED(NAME) ((NAME) == NULL)
|
||||
#else
|
||||
#define CONVERSION_FAILED(NAME) (0)
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue