mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-132641: fix race in lru_cache
under free-threading (#133787)
Fix race in `lru_cache` by acquiring critical section on the cache object itself and call the lock held variant of dict functions to modify the underlying dict.
This commit is contained in:
parent
35f47d0589
commit
9ad0c7b0f1
5 changed files with 94 additions and 5 deletions
|
@ -2915,6 +2915,11 @@ clear_lock_held(PyObject *op)
|
|||
ASSERT_CONSISTENT(mp);
|
||||
}
|
||||
|
||||
void
|
||||
_PyDict_Clear_LockHeld(PyObject *op) {
|
||||
clear_lock_held(op);
|
||||
}
|
||||
|
||||
void
|
||||
PyDict_Clear(PyObject *op)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue