Skip to content

Commit 9844e15

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Backport PyType_Modified on keys version change to 3.15
Summary: <!-- pyimport-metadata:begin --> This diff adds a patch to the `third-party/python/3.15` Meta-internal fork. Call PyType_Modified when the shared dictionary keys change Reviewed By: itamaro Differential Revision: D108322589 fbshipit-source-id: d8692cff1022150e45c641a7be6d05916eadea40
1 parent 73fc432 commit 9844e15

12 files changed

Lines changed: 1299 additions & 1411 deletions

File tree

Include/internal/pycore_dict.h

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

9292
extern PyDictKeysObject *_PyDict_NewKeysForClass(PyHeapTypeObject *);
93+
extern void _PyDict_RemoveKeysForClass(PyHeapTypeObject *);
94+
extern void _PyDict_SplitKeysInvalidated(PyDictKeysObject* keys);
9395
extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
9496

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

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+
242255
/* This must be no more than 250, for the prefix size to fit in one byte. */
243256
#define SHARED_KEYS_MAX_SIZE 30
244257
#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)