Skip to content

Commit 1ad2089

Browse files
clear running loop early
1 parent 4937ba5 commit 1ad2089

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Modules/_asynciomodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,6 +3724,9 @@ module_clear(PyObject *mod)
37243724

37253725
Py_CLEAR(state->context_kwname);
37263726

3727+
_PyThreadStateImpl *ts = (_PyThreadStateImpl *)_PyThreadState_GET();
3728+
Py_CLEAR(ts->asyncio_running_loop);
3729+
37273730
return 0;
37283731
}
37293732

Python/pystate.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,8 +1667,6 @@ PyThreadState_Clear(PyThreadState *tstate)
16671667
Py_CLEAR(tstate->threading_local_key);
16681668
Py_CLEAR(tstate->threading_local_sentinel);
16691669

1670-
Py_CLEAR(((_PyThreadStateImpl *)tstate)->asyncio_running_loop);
1671-
16721670
Py_CLEAR(tstate->dict);
16731671
Py_CLEAR(tstate->async_exc);
16741672

0 commit comments

Comments
 (0)