We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d54879 commit 4fd06e0Copy full SHA for 4fd06e0
Lib/test/test_weakref.py
@@ -252,6 +252,11 @@ def test_weak_values(self):
252
del objects, o
253
self.assert_(len(dict) == 0,
254
"deleting the values did not clear the dictionary")
255
+ # regression on SF bug #447152:
256
+ dict = weakref.WeakValueDictionary()
257
+ self.assertRaises(KeyError, dict.__getitem__, 1)
258
+ dict[2] = C()
259
+ self.assertRaises(KeyError, dict.__getitem__, 2)
260
261
def test_weak_keys(self):
262
#
Lib/weakref.py
@@ -41,7 +41,7 @@ class WeakValueDictionary(UserDict.UserDict):
41
# way in).
42
43
def __getitem__(self, key):
44
- o = self.data.get(key)()
+ o = self.data[key]()
45
if o is None:
46
raise KeyError, key
47
else:
0 commit comments