summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_pystate.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-02 01:39:38 (GMT)
committerGitHub <noreply@github.com>2023-07-02 01:39:38 (GMT)
commit8571b271e7d16fe87d669a2e1e50f5ae3732bb31 (patch)
treeeb2adf17a72bab4efbb439fa2f74cacdaa4ca5e9 /Include/internal/pycore_pystate.h
parentfeb51f3a6443d7c0148e2e7be2ed58b4c69fa265 (diff)
downloadcpython-8571b271e7d16fe87d669a2e1e50f5ae3732bb31.zip
cpython-8571b271e7d16fe87d669a2e1e50f5ae3732bb31.tar.gz
cpython-8571b271e7d16fe87d669a2e1e50f5ae3732bb31.tar.bz2
gh-106320: Remove private _PyInterpreterState functions (#106325)
Remove private _PyThreadState and _PyInterpreterState C API functions: move them to the internal C API (pycore_pystate.h and pycore_interp.h). Don't export most of these functions anymore, but still export functions used by tests. Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C API, but keep it in the stable API.
Diffstat (limited to 'Include/internal/pycore_pystate.h')
-rw-r--r--Include/internal/pycore_pystate.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h
index 63fc6b2..0659084 100644
--- a/Include/internal/pycore_pystate.h
+++ b/Include/internal/pycore_pystate.h
@@ -123,9 +123,6 @@ static inline PyInterpreterState* _PyInterpreterState_GET(void) {
PyAPI_FUNC(PyThreadState *) _PyThreadState_New(PyInterpreterState *interp);
PyAPI_FUNC(void) _PyThreadState_Bind(PyThreadState *tstate);
-// We keep this around exclusively for stable ABI compatibility.
-PyAPI_FUNC(void) _PyThreadState_Init(
- PyThreadState *tstate);
PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate);
extern void _PyThreadState_InitDetached(PyThreadState *, PyInterpreterState *);
@@ -133,6 +130,18 @@ extern void _PyThreadState_ClearDetached(PyThreadState *);
extern void _PyThreadState_BindDetached(PyThreadState *);
extern void _PyThreadState_UnbindDetached(PyThreadState *);
+PyAPI_FUNC(PyObject*) _PyThreadState_GetDict(PyThreadState *tstate);
+
+/* The implementation of sys._current_frames() Returns a dict mapping
+ thread id to that thread's current frame.
+*/
+extern PyObject* _PyThread_CurrentFrames(void);
+
+/* The implementation of sys._current_exceptions() Returns a dict mapping
+ thread id to that thread's current exception.
+*/
+extern PyObject* _PyThread_CurrentExceptions(void);
+
/* Other */
@@ -161,6 +170,10 @@ PyAPI_FUNC(int) _PyOS_InterruptOccurred(PyThreadState *tstate);
#define HEAD_UNLOCK(runtime) \
PyThread_release_lock((runtime)->interpreters.mutex)
+// Get the configuration of the current interpreter.
+// The caller must hold the GIL.
+PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
+
#ifdef __cplusplus
}