gh-112075: Iterating a dict shouldn't require locks (#115108)

Makes iteration of a dict be lock free for the forward iteration case.
This commit is contained in:
Dino Viehland 2024-02-22 12:02:39 -08:00 • committed by GitHub
parent a3859422d1
commit 1002fbe12e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 267 additions and 62 deletions

View file

@ -212,6 +212,7 @@ static inline PyDictUnicodeEntry* DK_UNICODE_ENTRIES(PyDictKeysObject *dk) {
#define DICT_WATCHER_AND_MODIFICATION_MASK ((1 << (DICT_MAX_WATCHERS + DICT_WATCHED_MUTATION_BITS)) - 1)
#define DICT_VALUES_SIZE(values) ((uint8_t *)values)[-1]
#define DICT_VALUES_USED_SIZE(values) ((uint8_t *)values)[-2]
#ifdef Py_GIL_DISABLED
#define DICT_NEXT_VERSION(INTERP) \