summaryrefslogtreecommitdiffstats
path: root/Lib/copy.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-06-17 17:10:11 (GMT)
committerGuido van Rossum <guido@python.org>1996-06-17 17:10:11 (GMT)
commit6afff6139a445de62a9cb45dadf1b9ca905f2540 (patch)
tree1d6b5786e13ee32647169b4892bf5c309ad4f915 /Lib/copy.py
parent7c46a920ae214c43b18a0c064c7bf80492a434c9 (diff)
downloadcpython-6afff6139a445de62a9cb45dadf1b9ca905f2540.zip
cpython-6afff6139a445de62a9cb45dadf1b9ca905f2540.tar.gz
cpython-6afff6139a445de62a9cb45dadf1b9ca905f2540.tar.bz2
Memoize _deepcopy_tuple() -- maybe this helps Tommy's problem.
Diffstat (limited to 'Lib/copy.py')
-rw-r--r--Lib/copy.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index a48e8c8..15e0e40 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -182,8 +182,12 @@ def _deepcopy_tuple(x, memo):
pass
for i in range(len(x)):
if x[i] is not y[i]:
- return tuple(y)
- return x
+ y = tuple(y)
+ break
+ else:
+ y = x
+ memo[d] = y
+ return y
d[types.TupleType] = _deepcopy_tuple
def _deepcopy_dict(x, memo):