Skip to content
Next Next commit
Factor out _dict_state_INIT.
  • Loading branch information
ericsnowcurrently committed May 6, 2023
commit 5bc2469e313d47e8e0daa7ffd3333e5638cfcbf2
7 changes: 7 additions & 0 deletions Include/internal/pycore_dict_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct _Py_dict_state {
uint64_t global_version;
uint32_t next_keys_version;

// PyDictKeysObject empty_keys_struct;
Comment thread
sunmy2019 marked this conversation as resolved.
Outdated

#if PyDict_MAXFREELIST > 0
/* Dictionary reuse scheme to save calls to malloc and free */
PyDictObject *free_list[PyDict_MAXFREELIST];
Expand All @@ -38,6 +40,11 @@ struct _Py_dict_state {
PyDict_WatchCallback watchers[DICT_MAX_WATCHERS];
};

#define _dict_state_INIT \
{ \
.next_keys_version = 2, \
}


#ifdef __cplusplus
}
Expand Down
4 changes: 1 addition & 3 deletions Include/internal/pycore_runtime_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
}, \
Expand Down