Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)

Unified Diff: Lib/copy.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/contextlib.py ('k') | Lib/ctypes/_endian.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/copy.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/copy.py Mon Jul 25 09:47:18 2011 -0400
@@ -173,10 +173,8 @@
"un(deep)copyable object of type %s" % cls)
y = _reconstruct(x, rv, 1, memo)
- # If is its own copy, don't memoize.
- if y is not x:
- memo[d] = y
- _keep_alive(x, memo) # Make sure x lives at least as long as d
+ memo[d] = y
+ _keep_alive(x, memo) # Make sure x lives at least as long as d
return y
_deepcopy_dispatch = d = {}
@@ -216,10 +214,9 @@
y = []
for a in x:
y.append(deepcopy(a, memo))
- # We're not going to put the tuple in the memo, but it's still important we
- # check for it, in case the tuple contains recursive mutable structures.
+ d = id(x)
try:
- return memo[id(x)]
+ return memo[d]
except KeyError:
pass
for i in range(len(x)):
@@ -228,6 +225,7 @@
break
else:
y = x
+ memo[d] = y
return y
d[tuple] = _deepcopy_tuple
« no previous file with comments | « Lib/contextlib.py ('k') | Lib/ctypes/_endian.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+