diff options
| author | Raymond Hettinger <python@rcn.com> | 2005-02-05 23:42:57 +0000 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2005-02-05 23:42:57 +0000 |
| commit | 07ead1731850a9f1bd353b9330341309251099b6 (patch) | |
| tree | 9c2b22041106d08e2a31b6665f1098c6fd3d8f12 | |
| parent | f7bf02ded533421a0e231c425ac7ff08b8efc589 (diff) | |
| download | cpython-git-07ead1731850a9f1bd353b9330341309251099b6.tar.gz | |
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 70f05e5def..82e82a8bc9 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; |
