mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-127705: Add debug mode for _PyStackRef
s inspired by HPy debug mode (GH-128121)
This commit is contained in:
parent
78ffba4221
commit
128cc47fbd
12 changed files with 395 additions and 33 deletions
|
@ -450,7 +450,7 @@ do { \
|
|||
/* How much scratch space to give stackref to PyObject* conversion. */
|
||||
#define MAX_STACKREF_SCRATCH 10
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
#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]; \
|
||||
|
@ -461,7 +461,7 @@ do { \
|
|||
assert(NAME != NULL);
|
||||
#endif
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
#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);
|
||||
|
@ -470,7 +470,7 @@ do { \
|
|||
(void)(NAME);
|
||||
#endif
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
#if defined(Py_GIL_DISABLED) || defined(Py_STACKREF_DEBUG)
|
||||
#define CONVERSION_FAILED(NAME) ((NAME) == NULL)
|
||||
#else
|
||||
#define CONVERSION_FAILED(NAME) (0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue