Skip to content

Commit 9626ef8

Browse files
authored
Revert commits: gh-151593: Fix dead lock in PyDict insert_split_key() (#152200) gh-150490: Raise PyType_Modified for insertion into split dictionary (#150489) For gh-150489, it violates locking discipline and results in deadlocks, gh-151593 is an example of it being hit in CI. The attempted fix gh-152200 avoids the deadlock but introduces a data-race. The race window is small but can be triggered with pure Python code.
1 parent 5a549e8 commit 9626ef8

12 files changed

Lines changed: 1411 additions & 1307 deletions

File tree

Include/internal/pycore_dict.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ typedef struct {
9090
} PyDictUnicodeEntry;
9191

9292
extern PyDictKeysObject *_PyDict_NewKeysForClass(PyHeapTypeObject *);
93-
extern void _PyDict_RemoveKeysForClass(PyHeapTypeObject *);
94-
extern void _PyDict_SplitKeysInvalidated(PyDictKeysObject* keys);
9593
extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
9694

9795
/* Implementations of the `|` and `|=` operators for dict, used by the
@@ -241,17 +239,6 @@ struct _dictkeysobject {
241239
see the DK_ENTRIES() / DK_UNICODE_ENTRIES() functions below */
242240
};
243241

244-
struct _instancekeysobject {
245-
PyTypeObject* dsk_owning_type;
246-
struct _dictkeysobject dsk_keys;
247-
};
248-
249-
static inline struct _instancekeysobject *_PyDictKeys_AsSharedKeys(struct _dictkeysobject *keys)
250-
{
251-
assert(keys->dk_kind == DICT_KEYS_SPLIT);
252-
return _Py_CONTAINER_OF(keys, struct _instancekeysobject, dsk_keys);
253-
}
254-
255242
/* This must be no more than 250, for the prefix size to fit in one byte. */
256243
#define SHARED_KEYS_MAX_SIZE 30
257244
#define NEXT_LOG2_SHARED_KEYS_MAX_SIZE 6

Include/internal/pycore_opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)