Changeset 388 for python/vendor/current/Lib/weakref.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/weakref.py
r2 r388 21 21 ReferenceType) 22 22 23 from _weakrefset import WeakSet 24 23 25 from exceptions import ReferenceError 24 26 … … 28 30 __all__ = ["ref", "proxy", "getweakrefcount", "getweakrefs", 29 31 "WeakKeyDictionary", "ReferenceError", "ReferenceType", "ProxyType", 30 "CallableProxyType", "ProxyTypes", "WeakValueDictionary" ]32 "CallableProxyType", "ProxyTypes", "WeakValueDictionary", 'WeakSet'] 31 33 32 34 … … 84 86 if o is not None: 85 87 new[key] = o 88 return new 89 90 __copy__ = copy 91 92 def __deepcopy__(self, memo): 93 from copy import deepcopy 94 new = self.__class__() 95 for key, wr in self.data.items(): 96 o = wr() 97 if o is not None: 98 new[deepcopy(key, memo)] = o 86 99 return new 87 100 … … 257 270 return new 258 271 272 __copy__ = copy 273 274 def __deepcopy__(self, memo): 275 from copy import deepcopy 276 new = self.__class__() 277 for key, value in self.data.items(): 278 o = key() 279 if o is not None: 280 new[o] = deepcopy(value, memo) 281 return new 282 259 283 def get(self, key, default=None): 260 284 return self.data.get(ref(key),default)
Note:
See TracChangeset
for help on using the changeset viewer.