File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -942,6 +942,17 @@ def make_weak_keyed_dict(self):
942942 dict [o ] = o .arg
943943 return dict , objects
944944
945+ def test_make_weak_valued_dict_from_dict (self ):
946+ o = Object (3 )
947+ dict = weakref .WeakValueDictionary ({364 :o })
948+ self .assertEqual (dict [364 ], o )
949+
950+ def test_make_weak_valued_dict_from_weak_valued_dict (self ):
951+ o = Object (3 )
952+ dict = weakref .WeakValueDictionary ({364 :o })
953+ dict2 = weakref .WeakValueDictionary (dict )
954+ self .assertEqual (dict [364 ], o )
955+
945956 def make_weak_valued_dict (self ):
946957 dict = weakref .WeakValueDictionary ()
947958 objects = list (map (Object , range (self .COUNT )))
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def remove(wr, selfref=ref(self)):
4949 del self .data [wr .key ]
5050 self ._remove = remove
5151 self .data = d = {}
52- d .update (* args , ** kw )
52+ self .update (* args , ** kw )
5353
5454 def __getitem__ (self , key ):
5555 o = self .data [key ]()
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ Core and Builtins
1515Library
1616-------
1717
18+ - Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty
19+ parameters.
20+
1821
1922What's New in Python 3.1 release candidate 1?
2023=============================================
You can’t perform that action at this time.
0 commit comments