mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
[3.13] gh-120973: Fix thread-safety issues with threading.local
(GH-121655) (#122042)
This is a small refactoring to the current design that allows us to
avoid manually iterating over threads.
This should also fix gh-118490.
(cherry picked from commit e059aa6b01
)
Co-authored-by: mpage <mpage@meta.com>
This commit is contained in:
parent
159ea47ed8
commit
bf7f4f357b
3 changed files with 245 additions and 150 deletions
|
@ -1702,6 +1702,9 @@ PyThreadState_Clear(PyThreadState *tstate)
|
|||
|
||||
/* Don't clear tstate->pyframe: it is a borrowed reference */
|
||||
|
||||
Py_CLEAR(tstate->threading_local_key);
|
||||
Py_CLEAR(tstate->threading_local_sentinel);
|
||||
|
||||
Py_CLEAR(((_PyThreadStateImpl *)tstate)->asyncio_running_loop);
|
||||
|
||||
Py_CLEAR(tstate->dict);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue