gh-121621: Move asyncio running loop to thread state (GH-121695)

This commit is contained in:
Ken Jin 2024-07-17 01:09:58 +08:00 committed by GitHub
parent 8f2532168b
commit 69c68de43a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 111 deletions

View file

@ -1499,6 +1499,8 @@ init_threadstate(_PyThreadStateImpl *_tstate,
tstate->previous_executor = NULL;
tstate->dict_global_version = 0;
tstate->asyncio_running_loop = NULL;
tstate->delete_later = NULL;
llist_init(&_tstate->mem_free_queue);
@ -1700,6 +1702,8 @@ PyThreadState_Clear(PyThreadState *tstate)
/* Don't clear tstate->pyframe: it is a borrowed reference */
Py_CLEAR(tstate->asyncio_running_loop);
Py_CLEAR(tstate->dict);
Py_CLEAR(tstate->async_exc);