diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-07-11 19:27:06 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-07-11 19:27:06 (GMT) |
commit | 16d037653d50a035f106636715095840e4fabe70 (patch) | |
tree | cc6659650dce5feafd22660dfc3a69a8699ff331 /Lib/_abcoll.py | |
parent | dedbbe6b3bfbf1fda4e333ec80507576c1725544 (diff) | |
download | cpython-16d037653d50a035f106636715095840e4fabe70.zip cpython-16d037653d50a035f106636715095840e4fabe70.tar.gz cpython-16d037653d50a035f106636715095840e4fabe70.tar.bz2 |
Merged revisions 82821 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82821 | mark.dickinson | 2010-07-11 19:53:06 +0100 (Sun, 11 Jul 2010) | 3 lines
Issue #9137: Fix issue in MutableMapping.update, which incorrectly
treated keyword arguments called 'self' or 'other' specially.
........
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r-- | Lib/_abcoll.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index e9f06a5..cc00fd9 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -480,7 +480,15 @@ class MutableMapping(Mapping): except KeyError: pass - def update(self, other=(), **kwds): + def update(*args, **kwds): + if len(args) > 2: + raise TypeError("update() takes at most 2 positional " + "arguments ({} given)".format(len(args))) + elif not args: + raise TypeError("update() takes at least 1 argument (0 given)") + self = args[0] + other = args[1] if len(args) >= 2 else () + if isinstance(other, Mapping): for key in other: self[key] = other[key] |