diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-05-10 13:28:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 13:28:40 (GMT) |
commit | b8f7ab5783b370004757af5a4c6e70c63dc5fe7a (patch) | |
tree | cea44d351f26241a2ed0c3c847c298a865119c96 /Include | |
parent | 2dcb289ed08980c8f97d538060b4ad8d5e82b56a (diff) | |
download | cpython-b8f7ab5783b370004757af5a4c6e70c63dc5fe7a.zip cpython-b8f7ab5783b370004757af5a4c6e70c63dc5fe7a.tar.gz cpython-b8f7ab5783b370004757af5a4c6e70c63dc5fe7a.tar.bz2 |
gh-104252: Immortalize Py_EMPTY_KEYS (gh-104253)
This was missed in gh-19474. It matters for with a per-interpreter GIL since PyDictKeysObject.dk_refcnt breaks isolation and leads to races.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_dict_state.h | 5 | ||||
-rw-r--r-- | Include/internal/pycore_runtime_init.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Include/internal/pycore_dict_state.h b/Include/internal/pycore_dict_state.h index d608088..ece0f10 100644 --- a/Include/internal/pycore_dict_state.h +++ b/Include/internal/pycore_dict_state.h @@ -38,6 +38,11 @@ struct _Py_dict_state { PyDict_WatchCallback watchers[DICT_MAX_WATCHERS]; }; +#define _dict_state_INIT \ + { \ + .next_keys_version = 2, \ + } + #ifdef __cplusplus } diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h index a48461c..3b1444f 100644 --- a/Include/internal/pycore_runtime_init.h +++ b/Include/internal/pycore_runtime_init.h @@ -107,9 +107,7 @@ extern PyTypeObject _PyExc_MemoryError; }, \ }, \ .dtoa = _dtoa_state_INIT(&(INTERP)), \ - .dict_state = { \ - .next_keys_version = 2, \ - }, \ + .dict_state = _dict_state_INIT, \ .func_state = { \ .next_version = 1, \ }, \ |