From 1fb6088e86ec84eb425b3f589bcb59d47a783b29 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 3 Jan 2001 22:34:59 +0000 Subject: dict_update has two boundary conditions: a.update(a) and a.update({}) Added test for second one. --- Objects/dictobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 42e270e..9398d0d 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -809,8 +809,8 @@ dict_update(register dictobject *mp, PyObject *args) dictentry *entry; if (!PyArg_Parse(args, "O!", &PyDict_Type, &other)) return NULL; - if (other == mp) - goto done; /* a.update(a); nothing to do */ + if (other == mp || other->ma_used == 0) + goto done; /* a.update(a) or a.update({}); nothing to do */ /* Do one big resize at the start, rather than incrementally resizing as we insert new items. Expect that there will be no (or few) overlapping keys. */ -- cgit v0.12