]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Code simplification -- eliminate lookup when value is known in advance.
authorRaymond Hettinger <python@rcn.com>
Sat, 5 Feb 2005 23:42:57 +0000 (23:42 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 5 Feb 2005 23:42:57 +0000 (23:42 +0000)
Objects/dictobject.c

index 70f05e5def3721d54390990f46c3e4a0b4276345..82e82a8bc92330ba852d7bdc63d51e0bf6143812 100644 (file)
@@ -400,8 +400,10 @@ insertdict(register dictobject *mp, PyObject *key, long hash, PyObject *value)
        else {
                if (ep->me_key == NULL)
                        mp->ma_fill++;
-               else
-                       Py_DECREF(ep->me_key);
+               else {
+                       assert(ep->me_key == dummy);
+                       Py_DECREF(dummy);
+               }
                ep->me_key = key;
                ep->me_hash = hash;
                ep->me_value = value;