File tree Expand file tree Collapse file tree 1 file changed +2
-25
lines changed Expand file tree Collapse file tree 1 file changed +2
-25
lines changed Original file line number Diff line number Diff line change @@ -820,31 +820,8 @@ _PyEval_AddPendingCall(PyInterpreterState *interp,
820
820
int
821
821
Py_AddPendingCall (int (* func )(void * ), void * arg )
822
822
{
823
- /* Best-effort to support subinterpreters and calls with the GIL released.
824
-
825
- First attempt _PyThreadState_GET() since it supports subinterpreters.
826
-
827
- If the GIL is released, _PyThreadState_GET() returns NULL . In this
828
- case, use PyGILState_GetThisThreadState() which works even if the GIL
829
- is released.
830
-
831
- Sadly, PyGILState_GetThisThreadState() doesn't support subinterpreters:
832
- see bpo-10915 and bpo-15751.
833
-
834
- Py_AddPendingCall() doesn't require the caller to hold the GIL. */
835
- PyThreadState * tstate = _PyThreadState_GET ();
836
- if (tstate == NULL ) {
837
- tstate = PyGILState_GetThisThreadState ();
838
- }
839
-
840
- PyInterpreterState * interp ;
841
- if (tstate != NULL ) {
842
- interp = tstate -> interp ;
843
- }
844
- else {
845
- /* Last resort: use the main interpreter */
846
- interp = _PyInterpreterState_Main ();
847
- }
823
+ /* Legacy users of this API will continue to target the main thread. */
824
+ PyInterpreterState * interp = _PyInterpreterState_Main ();
848
825
return _PyEval_AddPendingCall (interp , func , arg , 1 );
849
826
}
850
827
You can’t perform that action at this time.
0 commit comments