-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
The _struct module has a few small issues:
- The use of
PyDict_GetItemWithErrorreturns a borrowed reference (should usePyDict_GetItemRef) - The
state->cacheis lazily created; we should instead create it during_structmodule_exec - We want
state->cacheto be an immutable reference to a mutable dict. (Thedictwill be thread-safe.) UsePyDict_Clearto empty the dict instead of clearing the reference.
See the commit from the nogil-3.12 fork for context: colesbury/nogil-3.12@ada9b73feb. Note that in CPython the relevant function is PyDict_GetItemRef not PyDict_FetchItemWithError.
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