summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-11 18:53:06 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-11 18:53:06 (GMT)
commitb214e90e010f86b7d899cd88ada8c68fff90c870 (patch)
treeb00b722717f5cb5c31661204d343505fea97d151 /Lib/_abcoll.py
parent226f544caa2c2423610df2bc60453aa28cf17618 (diff)
downloadcpython-b214e90e010f86b7d899cd88ada8c68fff90c870.zip
cpython-b214e90e010f86b7d899cd88ada8c68fff90c870.tar.gz
cpython-b214e90e010f86b7d899cd88ada8c68fff90c870.tar.bz2
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.py10
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]