The default argument in dict.setdefault() defaults to None.

Add this default to weakref.WeakValueDictionary.setdefault()
and weakref.WeakKeyDictionary.setdefault() too.
This commit is contained in:
Walter Dörwald 2004-05-27 18:16:25 +00:00
parent c139909611
commit 80ce6dd564
1 changed files with 2 additions and 2 deletions

View File

@ -113,7 +113,7 @@ class WeakValueDictionary(UserDict.UserDict):
else: else:
return o return o
def setdefault(self, key, default): def setdefault(self, key, default=None):
try: try:
wr = self.data[key] wr = self.data[key]
except KeyError: except KeyError:
@ -241,7 +241,7 @@ class WeakKeyDictionary(UserDict.UserDict):
def pop(self, key, *args): def pop(self, key, *args):
return self.data.pop(ref(key), *args) return self.data.pop(ref(key), *args)
def setdefault(self, key, default): def setdefault(self, key, default=None):
return self.data.setdefault(ref(key, self._remove),default) return self.data.setdefault(ref(key, self._remove),default)
def update(self, dict=None, **kwargs): def update(self, dict=None, **kwargs):