Skip to content

Commit dfd6a8a

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Fix 3.15 build
Summary: We need to borrow a new function in dictobject.c Reviewed By: itamaro Differential Revision: D93643818 fbshipit-source-id: 38001b2924488537518b20d1b4c5c8156285c929
1 parent 98302a3 commit dfd6a8a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

cinderx/UpstreamBorrow/borrowed-3.15.c.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ PyDictKeysObject* ci_dict_empty_keys;
163163
// @Borrow function insert_split_value from Objects/dictobject.c [3.15]
164164
// @Borrow function insert_combined_dict from Objects/dictobject.c [3.15]
165165
// @Borrow function insertdict from Objects/dictobject.c [3.15]
166+
// @Borrow function anydict_setitem_take2 from Objects/dictobject.c [3.15]
166167
// @Borrow function setitem_take2_lock_held from Objects/dictobject.c [3.15]
167168
// @Borrow function setitem_lock_held from Objects/dictobject.c [3.15]
168169
// @Borrow function _PyDict_DelItem_KnownHash_LockHeld from Objects/dictobject.c [3.15]

cinderx/UpstreamBorrow/borrowed-3.15.gen_cached.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,26 @@ insertdict(PyDictObject *mp,
14561456
return -1;
14571457
}
14581458
static int
1459+
anydict_setitem_take2(PyDictObject *mp, PyObject *key, PyObject *value)
1460+
{
1461+
assert(key);
1462+
assert(value);
1463+
assert(PyAnyDict_Check(mp));
1464+
Py_hash_t hash = _PyObject_HashFast(key);
1465+
if (hash == -1) {
1466+
dict_unhashable_type(key);
1467+
Py_DECREF(key);
1468+
Py_DECREF(value);
1469+
return -1;
1470+
}
1471+
1472+
if (mp->ma_keys == Py_EMPTY_KEYS) {
1473+
return insert_to_emptydict(mp, key, hash, value);
1474+
}
1475+
/* insertdict() handles any resizing that might be necessary */
1476+
return insertdict(mp, key, hash, value);
1477+
}
1478+
static int
14591479
setitem_take2_lock_held(PyDictObject *mp, PyObject *key, PyObject *value)
14601480
{
14611481
ASSERT_DICT_LOCKED(mp);

0 commit comments

Comments
 (0)