summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-01-03 22:34:59 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-01-03 22:34:59 (GMT)
commit1fb6088e86ec84eb425b3f589bcb59d47a783b29 (patch)
tree28a5ccd2eedb4ff96f9aac7112759f902889acbf
parentdb60bb5aad6c0a2364e043e97e03e32083cd1999 (diff)
downloadcpython-1fb6088e86ec84eb425b3f589bcb59d47a783b29.zip
cpython-1fb6088e86ec84eb425b3f589bcb59d47a783b29.tar.gz
cpython-1fb6088e86ec84eb425b3f589bcb59d47a783b29.tar.bz2
dict_update has two boundary conditions: a.update(a) and a.update({})
Added test for second one.
-rw-r--r--Objects/dictobject.c4
1 files 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. */