diff options
author | Raymond Hettinger <python@rcn.com> | 2005-02-05 23:42:57 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-02-05 23:42:57 (GMT) |
commit | 07ead1731850a9f1bd353b9330341309251099b6 (patch) | |
tree | 9c2b22041106d08e2a31b6665f1098c6fd3d8f12 | |
parent | f7bf02ded533421a0e231c425ac7ff08b8efc589 (diff) | |
download | cpython-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.c | 6 |
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; |