https://github.com/python/cpython/commit/7bcc257e97ee080d1128788a12a1731afde26b0a
commit: 7bcc257e97ee080d1128788a12a1731afde26b0a
branch: main
author: Donghee Na <[email protected]>
committer: corona10 <[email protected]>
date: 2024-04-15T14:26:59+09:00
summary:

gh-117826: Remove lookdict_index from delitemif_lock_held (gh-117869)

files:
M Objects/dictobject.c

diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index e7993e4b051433..9c38ef2314684f 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;
     }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to