Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
Closed
Description
Feature or enhancement
The_struct
module has a few small issues:
- The use of
PyDict_GetItemWithError
returns a borrowed reference (should usePyDict_GetItemRef
) - The
state->cache
is lazily created; we should instead create it during_structmodule_exec
- We want
state->cache
to be an immutable reference to a mutable dict. (Thedict
will be thread-safe.) UsePyDict_Clear
to empty the dict instead of clearing the reference.
See the commit from thenogil-3.12
fork for context:colesbury/nogil-3.12@ada9b73feb. Note that in CPython the relevant function isPyDict_GetItemRef
notPyDict_FetchItemWithError
.