File tree Expand file tree Collapse file tree 5 files changed +11
-5
lines changed Expand file tree Collapse file tree 5 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ extern void _PyDict_Fini(PyInterpreterState *interp);
17
17
18
18
/* other API */
19
19
20
+ struct _Py_dict_runtime_state {
21
+ uint32_t next_keys_version ;
22
+ };
23
+
20
24
#ifndef WITH_FREELISTS
21
25
// without freelists
22
26
# define PyDict_MAXFREELIST 0
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ extern "C" {
9
9
#endif
10
10
11
11
#include "pycore_atomic.h" /* _Py_atomic_address */
12
+ #include "pycore_dict.h" // struct _Py_dict_runtime_state
12
13
#include "pycore_dtoa.h" // struct _dtoa_runtime_state
13
14
#include "pycore_floatobject.h" // struct _Py_float_runtime_state
14
15
#include "pycore_gil.h" // struct _gil_runtime_state
@@ -151,6 +152,7 @@ typedef struct pyruntimestate {
151
152
152
153
struct _Py_float_runtime_state float_state ;
153
154
struct _Py_unicode_runtime_state unicode_state ;
155
+ struct _Py_dict_runtime_state dict_state ;
154
156
155
157
struct {
156
158
/* Used to set PyTypeObject.tp_version_tag */
Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ extern "C" {
58
58
.float_format = _py_float_format_unknown, \
59
59
.double_format = _py_float_format_unknown, \
60
60
}, \
61
+ .dict_state = { \
62
+ .next_keys_version = 2, \
63
+ }, \
61
64
.types = { \
62
65
.next_version_tag = 1, \
63
66
}, \
Original file line number Diff line number Diff line change @@ -5661,17 +5661,15 @@ _PyDictKeys_DecRef(PyDictKeysObject *keys)
5661
5661
dictkeys_decref (keys );
5662
5662
}
5663
5663
5664
- static uint32_t next_dict_keys_version = 2 ;
5665
-
5666
5664
uint32_t _PyDictKeys_GetVersionForCurrentState (PyDictKeysObject * dictkeys )
5667
5665
{
5668
5666
if (dictkeys -> dk_version != 0 ) {
5669
5667
return dictkeys -> dk_version ;
5670
5668
}
5671
- if (next_dict_keys_version == 0 ) {
5669
+ if (_PyRuntime . dict_state . next_keys_version == 0 ) {
5672
5670
return 0 ;
5673
5671
}
5674
- uint32_t v = next_dict_keys_version ++ ;
5672
+ uint32_t v = _PyRuntime . dict_state . next_keys_version ++ ;
5675
5673
dictkeys -> dk_version = v ;
5676
5674
return v ;
5677
5675
}
Original file line number Diff line number Diff line change @@ -329,7 +329,6 @@ Python/suggestions.c levenshtein_distance buffer -
329
329
330
330
# other
331
331
Objects/dictobject.c - _pydict_global_version -
332
- Objects/dictobject.c - next_dict_keys_version -
333
332
Objects/funcobject.c - next_func_version -
334
333
Objects/object.c - _Py_RefTotal -
335
334
Python/perf_trampoline.c - perf_status -
You can’t perform that action at this time.
0 commit comments