mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
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. ........
This commit is contained in:
parent
3266978300
commit
42add99f77
3 changed files with 25 additions and 1 deletions
|
@ -466,7 +466,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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue