-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
3.13bugs and security fixesbugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
We should make functools.lru_cache thread-safe in the --disable-gil builds.
For context, here is the commit from the nogil-3.12 fork: colesbury/nogil-3.12@041a08e339
NOTES (differences in 3.13 from nogil-3.12):
- No need for an extra mutex in
lru_cache_object; every PyObject has a mutex in the--disable-gilbuilds - For
_functools__lru_cache_wrapper_cache_info_impland_functools__lru_cache_wrapper_cache_clear_implwe should instead use the@critical_sectionArugment Clinic directive. This will be simpler and require fewer changes to the code.lru_cache_callstill needs explicit calls to the critical section API.
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement