Skip to content

Commit 05079d9

Browse files
authored
gh-109868: Skip deepcopy memo check for empty memo (GH-109869)
1 parent 7dc2c50 commit 05079d9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/copy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ def deepcopy(x, memo=None, _nil=[]):
121121
See the module's __doc__ string for more info.
122122
"""
123123

124+
d = id(x)
124125
if memo is None:
125126
memo = {}
126-
127-
d = id(x)
128-
y = memo.get(d, _nil)
129-
if y is not _nil:
130-
return y
127+
else:
128+
y = memo.get(d, _nil)
129+
if y is not _nil:
130+
return y
131131

132132
cls = type(x)
133133

0 commit comments

Comments
 (0)