8000 gh-112075: Iterating a dict shouldn't require locks (#115108) · python/cpython@1002fbe · GitHub
[go: up one dir, main page]

Skip to content

Commit 1002fbe

Browse files
authored
gh-112075: Iterating a dict shouldn't require locks (#115108)
Makes iteration of a dict be lock free for the forward iteration case.
1 parent a385942 commit 1002fbe

File tree

2 files changed

+265
-60
lines changed

2 files changed

+265
-60
lines changed

Include/internal/pycore_dict.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ static inline PyDictUnicodeEntry* DK_UNICODE_ENTRIES(PyDictKeysObject *dk) {
212212
#define DICT_WATCHER_AND_MODIFICATION_MASK ((1 << (DICT_MAX_WATCHERS + DICT_WATCHED_MUTATION_BITS)) - 1)
213213

214214
#define DICT_VALUES_SIZE(values) ((uint8_t *)values)[-1]
215+
#define DICT_VALUES_USED_SIZE(values) ((uint8_t *)values)[-2]
215216

216217
#ifdef Py_GIL_DISABLED
217218
#define DICT_NEXT_VERSION(INTERP) \

0 commit comments

Comments
 (0)
0