summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-05-10 13:28:40 (GMT)
committerGitHub <noreply@github.com>2023-05-10 13:28:40 (GMT)
commitb8f7ab5783b370004757af5a4c6e70c63dc5fe7a (patch)
treecea44d351f26241a2ed0c3c847c298a865119c96 /Include
parent2dcb289ed08980c8f97d538060b4ad8d5e82b56a (diff)
downloadcpython-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.h5
-rw-r--r--Include/internal/pycore_runtime_init.h4
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, \
}, \