File tree 4 files changed +18
-2
lines changed 4 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1035,6 +1035,14 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
1035
1035
:c:func: `PyThreadState_Clear `.
1036
1036
1037
1037
1038
+ .. c :function :: void PyThreadState_DeleteCurrent ()
1039
+
1040
+ Destroy the current thread state and release the global interpreter lock.
1041
+ Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not
1042
+ be held. The thread state must have been reset with a previous call
1043
+ to :c:func:`PyThreadState_Clear`.
1044
+
1045
+
1038
1046
.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
1039
1047
1040
1048
Return the interpreter's unique ID. If there was any error in doing
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
183
183
PyAPI_FUNC (PyInterpreterState * ) PyInterpreterState_Next (PyInterpreterState * );
184
184
PyAPI_FUNC (PyThreadState * ) PyInterpreterState_ThreadHead (PyInterpreterState * );
185
185
PyAPI_FUNC (PyThreadState * ) PyThreadState_Next (PyThreadState * );
186
+ PyAPI_FUNC (void ) PyThreadState_DeleteCurrent (void );
186
187
187
188
typedef struct _frame * (* PyThreadFrameGetter )(PyThreadState * self_ );
188
189
Original file line number Diff line number Diff line change
1
+ Revert the removal of PyThreadState_DeleteCurrent() with documentation.
Original file line number Diff line number Diff line change @@ -801,7 +801,7 @@ PyThreadState_Clear(PyThreadState *tstate)
801
801
}
802
802
803
803
804
- /* Common code for PyThreadState_Delete() and _PyThreadState_DeleteCurrent () */
804
+ /* Common code for PyThreadState_Delete() and PyThreadState_DeleteCurrent () */
805
805
static void
806
806
tstate_delete_common (_PyRuntimeState * runtime , PyThreadState * tstate )
807
807
{
@@ -857,7 +857,7 @@ _PyThreadState_DeleteCurrent(_PyRuntimeState *runtime)
857
857
PyThreadState * tstate = _PyRuntimeGILState_GetThreadState (gilstate );
858
858
if (tstate == NULL )
859
859
Py_FatalError (
860
- "_PyThreadState_DeleteCurrent : no current tstate" );
860
+ "PyThreadState_DeleteCurrent : no current tstate" );
861
861
tstate_delete_common (runtime , tstate );
862
862
if (gilstate -> autoInterpreterState &&
863
863
PyThread_tss_get (& gilstate -> autoTSSkey ) == tstate )
@@ -868,6 +868,12 @@ _PyThreadState_DeleteCurrent(_PyRuntimeState *runtime)
868
868
PyEval_ReleaseLock ();
869
869
}
870
870
871
+ void
872
+ PyThreadState_DeleteCurrent (void )
873
+ {
874
+ _PyThreadState_DeleteCurrent (& _PyRuntime );
875
+ }
876
+
871
877
872
878
/*
873
879
* Delete all thread states except the one passed as argument.
You can’t perform that action at this time.
0 commit comments