]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-132641: fix race in `lru_cache` under free-threading (#133787)
authorPeter Hawkins <phawkins@google.com>
Tue, 13 May 2025 17:38:57 +0000 (13:38 -0400)
committerGitHub <noreply@github.com>
Tue, 13 May 2025 17:38:57 +0000 (17:38 +0000)
commit9ad0c7b0f14c5fcda6bfae6692c88abb95502d38
tree8d818a816699d0363098e527fd6f3bfad7cdccc4
parent35f47d05893e012e9f2b145b934c1d8c61d2bb7d
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.
Include/internal/pycore_dict.h
Lib/test/test_free_threading/test_functools.py [new file with mode: 0644]
Misc/NEWS.d/next/Library/2025-05-09-20-59-24.gh-issue-132641.3qTw44.rst [new file with mode: 0644]
Modules/_functoolsmodule.c
Objects/dictobject.c