diff options
| author | Victor Stinner <vstinner@python.org> | 2023-07-02 01:39:38 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-02 01:39:38 (GMT) |
| commit | 8571b271e7d16fe87d669a2e1e50f5ae3732bb31 (patch) | |
| tree | eb2adf17a72bab4efbb439fa2f74cacdaa4ca5e9 /Python | |
| parent | feb51f3a6443d7c0148e2e7be2ed58b4c69fa265 (diff) | |
| download | cpython-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 'Python')
| -rw-r--r-- | Python/compile.c | 1 | ||||
| -rw-r--r-- | Python/frozenmain.c | 3 | ||||
| -rw-r--r-- | Python/pystate.c | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c index d83bf08..29ea274 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -33,6 +33,7 @@ #include "pycore_compile.h" #include "pycore_intrinsics.h" #include "pycore_long.h" // _PyLong_GetZero() +#include "pycore_pystate.h" // _Py_GetConfig() #include "pycore_symtable.h" // PySTEntryObject, _PyFuture_FromAST() #include "opcode_metadata.h" // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed diff --git a/Python/frozenmain.c b/Python/frozenmain.c index f8be165..767f980 100644 --- a/Python/frozenmain.c +++ b/Python/frozenmain.c @@ -1,7 +1,8 @@ /* Python interpreter main program for frozen scripts */ #include "Python.h" -#include "pycore_runtime.h" // _PyRuntime_Initialize() +#include "pycore_pystate.h" // _Py_GetConfig() +#include "pycore_runtime.h" // _PyRuntime_Initialize() #include <locale.h> #ifdef MS_WINDOWS diff --git a/Python/pystate.c b/Python/pystate.c index 20b02ef..50ce1d0 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1166,7 +1166,7 @@ PyInterpreterState_GetDict(PyInterpreterState *interp) The GIL must be held. */ -PyInterpreterState * +PyInterpreterState* PyInterpreterState_Get(void) { PyThreadState *tstate = current_fast_get(&_PyRuntime); @@ -1408,7 +1408,7 @@ _PyThreadState_New(PyInterpreterState *interp) } // We keep this for stable ABI compabibility. -PyThreadState * +PyAPI_FUNC(PyThreadState*) _PyThreadState_Prealloc(PyInterpreterState *interp) { return _PyThreadState_New(interp); @@ -1416,7 +1416,7 @@ _PyThreadState_Prealloc(PyInterpreterState *interp) // We keep this around for (accidental) stable ABI compatibility. // Realistically, no extensions are using it. -void +PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *tstate) { Py_FatalError("_PyThreadState_Init() is for internal use only"); |
