File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -1704,16 +1704,14 @@ PyThreadState *
17041704_PyThreadState_Swap (_PyRuntimeState * runtime , PyThreadState * newts )
17051705{
17061706 PyThreadState * oldts = current_fast_get (runtime );
1707- // XXX tstate_is_bound(oldts)
1707+
1708+ current_fast_clear (runtime );
1709+
17081710 if (oldts != NULL ) {
1709- // XXX assert(oldts == NULL || tstate_is_alive (oldts));
1711+ // XXX assert(tstate_is_alive( oldts) && tstate_is_bound (oldts));
17101712 tstate_deactivate (oldts );
17111713 }
1712-
1713- if (newts == NULL ) {
1714- current_fast_clear (runtime );
1715- }
1716- else {
1714+ if (newts != NULL ) {
17171715 assert (tstate_is_alive (newts ) && tstate_is_bound (newts ));
17181716 current_fast_set (runtime , newts );
17191717 tstate_activate (newts );
@@ -1731,8 +1729,10 @@ _PyThreadState_Swap(_PyRuntimeState *runtime, PyThreadState *newts)
17311729 */
17321730 int err = errno ;
17331731 PyThreadState * check = gilstate_tss_get (runtime );
1734- if (check && check -> interp == newts -> interp && check != newts ) {
1735- Py_FatalError ("Invalid thread state for this thread" );
1732+ if (check != newts ) {
1733+ if (check && check -> interp == newts -> interp ) {
1734+ Py_FatalError ("Invalid thread state for this thread" );
1735+ }
17361736 }
17371737 errno = err ;
17381738 }
You can’t perform that action at this time.
0 commit comments