summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-03-09 01:04:16 (GMT)
committerGitHub <noreply@github.com>2023-03-09 01:04:16 (GMT)
commit5e5acd291f4387876afc641163e9f8ae5c65086c (patch)
treeb1ae91adf3e2ea87b110c6f1d95b265c084d7201 /Include
parent66ff374d4f353ae427c148d2a1d141d223303a82 (diff)
downloadcpython-5e5acd291f4387876afc641163e9f8ae5c65086c.zip
cpython-5e5acd291f4387876afc641163e9f8ae5c65086c.tar.gz
cpython-5e5acd291f4387876afc641163e9f8ae5c65086c.tar.bz2
gh-100227: Move next_keys_version to PyInterpreterState (gh-102335)
https://github.com/python/cpython/issues/100227
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_dict.h3
-rw-r--r--Include/internal/pycore_dict_state.h4
-rw-r--r--Include/internal/pycore_runtime_init.h6
3 files changed, 8 insertions, 5 deletions
diff --git a/Include/internal/pycore_dict.h b/Include/internal/pycore_dict.h
index 1af5e59..12c3c70 100644
--- a/Include/internal/pycore_dict.h
+++ b/Include/internal/pycore_dict.h
@@ -37,7 +37,8 @@ extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
/* Gets a version number unique to the current state of the keys of dict, if possible.
* Returns the version number, or zero if it was not possible to get a version number. */
-extern uint32_t _PyDictKeys_GetVersionForCurrentState(PyDictKeysObject *dictkeys);
+extern uint32_t _PyDictKeys_GetVersionForCurrentState(
+ PyInterpreterState *interp, PyDictKeysObject *dictkeys);
extern size_t _PyDict_KeysSize(PyDictKeysObject *keys);
diff --git a/Include/internal/pycore_dict_state.h b/Include/internal/pycore_dict_state.h
index 77375ea..c5142ee 100644
--- a/Include/internal/pycore_dict_state.h
+++ b/Include/internal/pycore_dict_state.h
@@ -14,7 +14,6 @@ struct _Py_dict_runtime_state {
* It is incremented each time that a dictionary is created and each
* time that a dictionary is modified. */
uint64_t global_version;
- uint32_t next_keys_version;
};
@@ -30,6 +29,8 @@ struct _Py_dict_runtime_state {
#define DICT_MAX_WATCHERS 8
struct _Py_dict_state {
+ uint32_t next_keys_version;
+
#if PyDict_MAXFREELIST > 0
/* Dictionary reuse scheme to save calls to malloc and free */
PyDictObject *free_list[PyDict_MAXFREELIST];
@@ -37,6 +38,7 @@ struct _Py_dict_state {
int numfree;
int keys_numfree;
#endif
+
PyDict_WatchCallback watchers[DICT_MAX_WATCHERS];
};
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index aeabcfd..efc82b4 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -65,9 +65,6 @@ extern PyTypeObject _PyExc_MemoryError;
.float_format = _py_float_format_unknown, \
.double_format = _py_float_format_unknown, \
}, \
- .dict_state = { \
- .next_keys_version = 2, \
- }, \
.types = { \
.next_version_tag = 1, \
}, \
@@ -113,6 +110,9 @@ extern PyTypeObject _PyExc_MemoryError;
}, \
}, \
.dtoa = _dtoa_state_INIT(&(INTERP)), \
+ .dict_state = { \
+ .next_keys_version = 2, \
+ }, \
.func_state = { \
.next_version = 1, \
}, \