Skip to content

Commit 988ba6d

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Fix OSS build to handle lack of backported PyType_Modified feature
Summary: D108322587 broke the 3.14 OSS build because our borrows now pick up the new feature but it's not available in stock CPython. This puts the code to appropriately use the META_PYTHON ifdef. Reviewed By: itamaro Differential Revision: D108447963 fbshipit-source-id: 7df5d321af65ea0ff1f3155c982fc323ff041189
1 parent 52ea8c5 commit 988ba6d

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

Objects/dictobject.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,11 @@ free_keys_object(PyDictKeysObject *keys, bool use_qsbr)
871871
size_t size = _PyDict_KeysSize(keys);
872872
#endif
873873
if (DK_KIND(keys) == DICT_KEYS_SPLIT) {
874+
#ifdef META_PYTHON
874875
ptr = _PyDictKeys_AsSharedKeys(keys);
876+
#else
877+
ptr = keys;
878+
#endif
875879
#ifdef Py_GIL_DISABLED
876880
size += offsetof(struct _instancekeysobject, dsk_keys);
877881
#endif
@@ -2335,7 +2339,9 @@ insert_split_key(PyDictKeysObject *keys, PyObject *key, Py_hash_t hash)
23352339
if (ix == DKIX_EMPTY && keys->dk_usable > 0) {
23362340
// Insert into new slot
23372341
FT_ATOMIC_STORE_UINT32_RELAXED(keys->dk_version, 0);
2342+
#ifdef META_PYTHON
23382343
_PyDict_SplitKeysInvalidated(keys);
2344+
#endif
23392345
Py_ssize_t hashpos = find_empty_slot(keys, hash);
23402346
ix = keys->dk_nentries;
23412347
dictkeys_set_index(keys, hashpos, ix);

Python/specialize.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,9 @@ specialize_attr_loadclassattr(PyObject *owner, _Py_CODEUNIT *instr,
16211621
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OUT_OF_VERSIONS);
16221622
return 0;
16231623
}
1624+
#ifndef META_PYTHON
1625+
write_u32(cache->keys_version, shared_keys_version);
1626+
#endif
16241627
specialize(instr, is_method ? LOAD_ATTR_METHOD_WITH_VALUES : LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES);
16251628
}
16261629
else {

0 commit comments

Comments
 (0)