@@ -327,11 +327,24 @@ PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
327327PyAPI_FUNC (int ) PyThreadState_SetAsyncExc (unsigned long , PyObject * );
328328
329329
330+ /* Routines for advanced debuggers, requested by David Beazley.
331+ Don't use unless you know what you are doing! */
332+ #ifndef Py_LIMITED_API
333+ PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Main (void );
334+ PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Head (void );
335+ PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Next (PyInterpreterState * );
336+ PyAPI_FUNC (PyThreadState * ) PyInterpreterState_ThreadHead (PyInterpreterState * );
337+ PyAPI_FUNC (PyThreadState * ) PyThreadState_Next (PyThreadState * );
338+
339+ typedef struct _frame * (* PyThreadFrameGetter )(PyThreadState * self_ );
340+ #endif
341+
330342/* Variable and macro for in-line access to current thread state */
331343
332344/* Assuming the current thread holds the GIL, this is the
333345 PyThreadState for the current thread. */
334346#ifdef Py_BUILD_CORE
347+ # include "internal/pystate.h"
335348# define _PyThreadState_Current _PyRuntime.gilstate.tstate_current
336349# define PyThreadState_GET () \
337350 ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
@@ -408,18 +421,6 @@ PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void);
408421PyAPI_FUNC (PyObject * ) _PyThread_CurrentFrames (void );
409422#endif
410423
411- /* Routines for advanced debuggers, requested by David Beazley.
412- Don't use unless you know what you are doing! */
413- #ifndef Py_LIMITED_API
414- PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Main (void );
415- PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Head (void );
416- PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Next (PyInterpreterState * );
417- PyAPI_FUNC (PyThreadState * ) PyInterpreterState_ThreadHead (PyInterpreterState * );
418- PyAPI_FUNC (PyThreadState * ) PyThreadState_Next (PyThreadState * );
419-
420- typedef struct _frame * (* PyThreadFrameGetter )(PyThreadState * self_ );
421- #endif
422-
423424#ifdef __cplusplus
424425}
425426#endif
0 commit comments