diff options
author | Donghee Na <donghee.na@python.org> | 2024-04-15 05:26:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 05:26:59 (GMT) |
commit | 7bcc257e97ee080d1128788a12a1731afde26b0a (patch) | |
tree | 37b933be5da1db2e65d81752d63f5b97df924116 | |
parent | 74b0658e6aa6d304cf1dffeab52a30d706ecce47 (diff) | |
download | cpython-7bcc257e97ee080d1128788a12a1731afde26b0a.zip cpython-7bcc257e97ee080d1128788a12a1731afde26b0a.tar.gz cpython-7bcc257e97ee080d1128788a12a1731afde26b0a.tar.bz2 |
gh-117826: Remove lookdict_index from delitemif_lock_held (gh-117869)
-rw-r--r-- | Objects/dictobject.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index e7993e4..9c38ef2 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2603,7 +2603,7 @@ static int delitemif_lock_held(PyObject *op, PyObject *key, int (*predicate)(PyObject *value)) { - Py_ssize_t hashpos, ix; + Py_ssize_t ix; PyDictObject *mp; Py_hash_t hash; PyObject *old_value; @@ -2632,14 +2632,11 @@ delitemif_lock_held(PyObject *op, PyObject *key, if (res == -1) return -1; - hashpos = lookdict_index(mp->ma_keys, hash, ix); - assert(hashpos >= 0); - if (res > 0) { PyInterpreterState *interp = _PyInterpreterState_GET(); uint64_t new_version = _PyDict_NotifyEvent( interp, PyDict_EVENT_DELETED, mp, key, NULL); - return delitem_common(mp, hashpos, ix, old_value, new_version); + return delitem_common(mp, hash, ix, old_value, new_version); } else { return 0; } |