summaryrefslogtreecommitdiffstats
path: root/Lib/copy.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-05-15 17:04:50 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-05-15 17:04:50 (GMT)
commit6e61006cc2dfa6c07fa84126622685769bac635d (patch)
tree4ec0f42d852421dac3776e533f51278f5259791e /Lib/copy.py
parentbd3da6b9804fafe6a730883d96bada52388e9835 (diff)
downloadcpython-6e61006cc2dfa6c07fa84126622685769bac635d.zip
cpython-6e61006cc2dfa6c07fa84126622685769bac635d.tar.gz
cpython-6e61006cc2dfa6c07fa84126622685769bac635d.tar.bz2
Merged revisions 72669 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72669 | antoine.pitrou | 2009-05-15 18:54:52 +0200 (ven., 15 mai 2009) | 3 lines Issue #2116: Weak references and weak dictionaries now support copy()ing and deepcopy()ing. ........
Diffstat (limited to 'Lib/copy.py')
-rw-r--r--Lib/copy.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index a334b79..2646350 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -49,6 +49,7 @@ __getstate__() and __setstate__(). See the documentation for module
"""
import types
+import weakref
from copyreg import dispatch_table
class Error(Exception):
@@ -102,7 +103,7 @@ def _copy_immutable(x):
for t in (type(None), int, float, bool, str, tuple,
frozenset, type, range,
types.BuiltinFunctionType, type(Ellipsis),
- types.FunctionType):
+ types.FunctionType, weakref.ref):
d[t] = _copy_immutable
t = getattr(types, "CodeType", None)
if t is not None:
@@ -198,6 +199,7 @@ d[type] = _deepcopy_atomic
d[range] = _deepcopy_atomic
d[types.BuiltinFunctionType] = _deepcopy_atomic
d[types.FunctionType] = _deepcopy_atomic
+d[weakref.ref] = _deepcopy_atomic
def _deepcopy_list(x, memo):
y = []