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 *
1704
1704
_PyThreadState_Swap (_PyRuntimeState * runtime , PyThreadState * newts )
1705
1705
{
1706
1706
PyThreadState * oldts = current_fast_get (runtime );
1707
- // XXX tstate_is_bound(oldts)
1707
+
1708
+ current_fast_clear (runtime );
1709
+
1708
1710
if (oldts != NULL ) {
1709
- // XXX assert(oldts == NULL || tstate_is_alive (oldts));
1711
+ // XXX assert(tstate_is_alive( oldts) && tstate_is_bound (oldts));
1710
1712
tstate_deactivate (oldts );
1711
1713
}
1712
-
1713
- if (newts == NULL ) {
1714
- current_fast_clear (runtime );
1715
- }
1716
- else {
1714
+ if (newts != NULL ) {
1717
1715
assert (tstate_is_alive (newts ) && tstate_is_bound (newts ));
1718
1716
current_fast_set (runtime , newts );
1719
1717
tstate_activate (newts );
@@ -1731,8 +1729,10 @@ _PyThreadState_Swap(_PyRuntimeState *runtime, PyThreadState *newts)
1731
1729
*/
1732
1730
int err = errno ;
1733
1731
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
+ }
1736
1736
}
1737
1737
errno = err ;
1738
1738
}
You can’t perform that action at this time.
0 commit comments