Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 547607c commit 6115460Copy full SHA for 6115460
1 file changed
Lib/copy.py
@@ -185,6 +185,7 @@ def deepcopy(x, memo = None):
185
else:
186
y = copierfunction(x, memo)
187
memo[d] = y
188
+ _keep_alive(x, memo) # Make sure x lives at least as long as d
189
return y
190
191
_deepcopy_dispatch = d = {}
@@ -269,7 +270,6 @@ def _deepcopy_inst(x, memo):
269
270
return x.__deepcopy__(memo)
271
if hasattr(x, '__getinitargs__'):
272
args = x.__getinitargs__()
- _keep_alive(args, memo)
273
args = deepcopy(args, memo)
274
y = apply(x.__class__, args)
275
@@ -278,7 +278,6 @@ def _deepcopy_inst(x, memo):
278
memo[id(x)] = y
279
if hasattr(x, '__getstate__'):
280
state = x.__getstate__()
281
- _keep_alive(state, memo)
282
283
state = x.__dict__
284
state = deepcopy(state, memo)
0 commit comments