summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-02-05 23:42:57 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-02-05 23:42:57 (GMT)
commit07ead1731850a9f1bd353b9330341309251099b6 (patch)
tree9c2b22041106d08e2a31b6665f1098c6fd3d8f12
parentf7bf02ded533421a0e231c425ac7ff08b8efc589 (diff)
downloadcpython-07ead1731850a9f1bd353b9330341309251099b6.zip
cpython-07ead1731850a9f1bd353b9330341309251099b6.tar.gz
cpython-07ead1731850a9f1bd353b9330341309251099b6.tar.bz2
Code simplification -- eliminate lookup when value is known in advance.
-rw-r--r--Objects/dictobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 70f05e5..82e82a8 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -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;