]> granicus.if.org Git - python/commitdiff
Issue #28040: Cleanup find_empty_slot()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 13 Sep 2016 07:38:29 +0000 (09:38 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 13 Sep 2016 07:38:29 +0000 (09:38 +0200)
find_empty_slot() only supports combined dict

Objects/dictobject.c

index 8b88ec6eef2ff56b2e44fbf6d85c7c711a38954a..bb5962a1a5e2f7e31894b38bdd7e0acac0246b9f 100644 (file)
@@ -987,7 +987,7 @@ _PyDict_MaybeUntrack(PyObject *op)
    when it is known that the key is not present in the dict.
 
    The dict must be combined. */
-static Py_ssize_t
+static void
 find_empty_slot(PyDictObject *mp, PyObject *key, Py_hash_t hash,
                 PyObject ***value_addr, Py_ssize_t *hashpos)
 {
@@ -1011,11 +1011,7 @@ find_empty_slot(PyDictObject *mp, PyObject *key, Py_hash_t hash,
     ep = &ep0[mp->ma_keys->dk_nentries];
     *hashpos = i & mask;
     assert(ep->me_value == NULL);
-    if (mp->ma_values)
-        *value_addr = &mp->ma_values[ix];
-    else
-        *value_addr = &ep->me_value;
-    return ix;
+    *value_addr = &ep->me_value;
 }
 
 static int