Skip to content

Commit 21a7420

Browse files
authored
gh-106320: Remove private _PyGILState_GetInterpreterStateUnsafe() (#108603)
The remove private _PyGILState_GetInterpreterStateUnsafe() function from the public C API: move it the internal C API (pycore_pystate.h). No longer export the function.
1 parent 07cf33e commit 21a7420

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

Include/cpython/pystate.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,6 @@ PyAPI_FUNC(void) PyThreadState_LeaveTracing(PyThreadState *tstate);
227227
The function returns 1 if _PyGILState_check_enabled is non-zero. */
228228
PyAPI_FUNC(int) PyGILState_Check(void);
229229

230-
/* Get the single PyInterpreterState used by this process' GILState
231-
implementation.
232-
233-
This function doesn't check for error. Return NULL before _PyGILState_Init()
234-
is called and after _PyGILState_Fini() is called.
235-
236-
See also PyInterpreterState_Get() and _PyInterpreterState_GET(). */
237-
PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void);
238-
239230
/* Routines for advanced debuggers, requested by David Beazley.
240231
Don't use unless you know what you are doing! */
241232
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Main(void);

Include/internal/pycore_pystate.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ extern int _PyOS_InterruptOccurred(PyThreadState *tstate);
174174
// Export for test_peg_generator.
175175
PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
176176

177+
// Get the single PyInterpreterState used by this process' GILState
178+
// implementation.
179+
//
180+
// This function doesn't check for error. Return NULL before _PyGILState_Init()
181+
// is called and after _PyGILState_Fini() is called.
182+
//
183+
// See also PyInterpreterState_Get() and _PyInterpreterState_GET().
184+
extern PyInterpreterState* _PyGILState_GetInterpreterStateUnsafe(void);
177185

178186
#ifdef __cplusplus
179187
}

0 commit comments

Comments
 (0)