Index: b/Include/pystate.h =================================================================== --- a/Include/pystate.h +++ b/Include/pystate.h @@ -306,11 +306,24 @@ PyAPI_FUNC(PyObject *) PyThreadState_Get PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); +/* Routines for advanced debuggers, requested by David Beazley. + Don't use unless you know what you are doing! */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); + +typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); +#endif + /* Variable and macro for in-line access to current thread state */ /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE +# include "internal/pystate.h" # define _PyThreadState_Current _PyRuntime.gilstate.tstate_current # define PyThreadState_GET() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) @@ -387,18 +400,6 @@ PyAPI_FUNC(PyInterpreterState *) _PyGILS PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); #endif -/* Routines for advanced debuggers, requested by David Beazley. - Don't use unless you know what you are doing! */ -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void); -PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); -PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); -PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); -PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); - -typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); -#endif - #ifdef __cplusplus } #endif Index: b/Include/internal/pystate.h =================================================================== --- a/Include/internal/pystate.h +++ b/Include/internal/pystate.h @@ -7,6 +7,8 @@ extern "C" { #include "pystate.h" #include "pyatomic.h" #include "pythread.h" +#include "pyerrors.h" +#include "pylifecycle.h" #include "internal/mem.h" #include "internal/ceval.h"