GH-127705: Add debug mode for _PyStackRefs inspired by HPy debug mode (GH-128121)

This commit is contained in:
Mark Shannon 2024-12-20 16:52:20 +00:00 committed by GitHub
parent 78ffba4221
commit 128cc47fbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 395 additions and 33 deletions

View file

@ -34,6 +34,7 @@ extern "C" {
#include "pycore_optimizer.h" // _PyOptimizerObject
#include "pycore_obmalloc.h" // struct _obmalloc_state
#include "pycore_qsbr.h" // struct _qsbr_state
#include "pycore_stackref.h" // Py_STACKREF_DEBUG
#include "pycore_tstate.h" // _PyThreadStateImpl
#include "pycore_tuple.h" // struct _Py_tuple_state
#include "pycore_uniqueid.h" // struct _Py_unique_id_pool
@ -285,6 +286,11 @@ struct _is {
_PyThreadStateImpl _initial_thread;
// _initial_thread should be the last field of PyInterpreterState.
// See https://github.com/python/cpython/issues/127117.
#if !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG)
uint64_t next_stackref;
_Py_hashtable_t *stackref_debug_table;
#endif
};