@@ -451,7 +451,7 @@ run_at_forkers(PyObject *lst, int reverse)
451451void
452452PyOS_BeforeFork (void )
453453{
454- run_at_forkers (_PyInterpreterState_GET_UNSAFE ()-> before_forkers , 1 );
454+ run_at_forkers (_PyInterpreterState_GET ()-> before_forkers , 1 );
455455
456456 _PyImport_AcquireLock ();
457457}
@@ -462,7 +462,7 @@ PyOS_AfterFork_Parent(void)
462462 if (_PyImport_ReleaseLock () <= 0 )
463463 Py_FatalError ("failed releasing import lock after fork" );
464464
465- run_at_forkers (_PyInterpreterState_GET_UNSAFE ()-> after_forkers_parent , 0 );
465+ run_at_forkers (_PyInterpreterState_GET ()-> after_forkers_parent , 0 );
466466}
467467
468468void
@@ -476,7 +476,7 @@ PyOS_AfterFork_Child(void)
476476 _PyRuntimeState_ReInitThreads (runtime );
477477 _PyInterpreterState_DeleteExceptMain (runtime );
478478
479- run_at_forkers (_PyInterpreterState_GET_UNSAFE ()-> after_forkers_child , 0 );
479+ run_at_forkers (_PyInterpreterState_GET ()-> after_forkers_child , 0 );
480480}
481481
482482static int
@@ -6185,7 +6185,7 @@ os_register_at_fork_impl(PyObject *module, PyObject *before,
61856185 check_null_or_callable (after_in_parent , "after_in_parent" )) {
61866186 return NULL ;
61876187 }
6188- interp = _PyInterpreterState_GET_UNSAFE ();
6188+ interp = _PyInterpreterState_GET ();
61896189
61906190 if (register_at_forker (& interp -> before_forkers , before )) {
61916191 return NULL ;
@@ -6216,7 +6216,7 @@ os_fork1_impl(PyObject *module)
62166216{
62176217 pid_t pid ;
62186218
6219- if (_PyInterpreterState_GET_UNSAFE () != PyInterpreterState_Main ()) {
6219+ if (_PyInterpreterState_GET () != PyInterpreterState_Main ()) {
62206220 PyErr_SetString (PyExc_RuntimeError , "fork not supported for subinterpreters" );
62216221 return NULL ;
62226222 }
@@ -6251,7 +6251,7 @@ os_fork_impl(PyObject *module)
62516251{
62526252 pid_t pid ;
62536253
6254- if (_PyInterpreterState_GET_UNSAFE () != PyInterpreterState_Main ()) {
6254+ if (_PyInterpreterState_GET () != PyInterpreterState_Main ()) {
62556255 PyErr_SetString (PyExc_RuntimeError , "fork not supported for subinterpreters" );
62566256 return NULL ;
62576257 }
@@ -6859,7 +6859,7 @@ os_forkpty_impl(PyObject *module)
68596859 int master_fd = -1 ;
68606860 pid_t pid ;
68616861
6862- if (_PyInterpreterState_GET_UNSAFE () != PyInterpreterState_Main ()) {
6862+ if (_PyInterpreterState_GET () != PyInterpreterState_Main ()) {
68636863 PyErr_SetString (PyExc_RuntimeError , "fork not supported for subinterpreters" );
68646864 return NULL ;
68656865 }
0 commit comments