[Python-checkins] r73063 - in python/branches/py3k: Lib/test/test_weakref.py Lib/weakref.py Misc/NEWS
antoine.pitrou
python-checkins at python.org
Sat May 30 23:04:26 CEST 2009
Author: antoine.pitrou
Date: Sat May 30 23:04:26 2009
New Revision: 73063
Log:
Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty parameters.
Modified:
python/branches/py3k/Lib/test/test_weakref.py
python/branches/py3k/Lib/weakref.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/test/test_weakref.py
==============================================================================
--- python/branches/py3k/Lib/test/test_weakref.py (original)
+++ python/branches/py3k/Lib/test/test_weakref.py Sat May 30 23:04:26 2009
@@ -942,6 +942,17 @@
dict[o] = o.arg
return dict, objects
+ def test_make_weak_valued_dict_from_dict(self):
+ o = Object(3)
+ dict = weakref.WeakValueDictionary({364:o})
+ self.assertEqual(dict[364], o)
+
+ def test_make_weak_valued_dict_from_weak_valued_dict(self):
+ o = Object(3)
+ dict = weakref.WeakValueDictionary({364:o})
+ dict2 = weakref.WeakValueDictionary(dict)
+ self.assertEqual(dict[364], o)
+
def make_weak_valued_dict(self):
dict = weakref.WeakValueDictionary()
objects = list(map(Object, range(self.COUNT)))
Modified: python/branches/py3k/Lib/weakref.py
==============================================================================
--- python/branches/py3k/Lib/weakref.py (original)
+++ python/branches/py3k/Lib/weakref.py Sat May 30 23:04:26 2009
@@ -49,7 +49,7 @@
del self.data[wr.key]
self._remove = remove
self.data = d = {}
- d.update(*args, **kw)
+ self.update(*args, **kw)
def __getitem__(self, key):
o = self.data[key]()
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sat May 30 23:04:26 2009
@@ -15,6 +15,9 @@
Library
-------
+- Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty
+ parameters.
+
What's New in Python 3.1 release candidate 1?
=============================================
More information about the Python-checkins
mailing list