Skip to content

Commit d7b07eb

Browse files
committed
Revert optimization for nested empty containers
1 parent ba7298c commit d7b07eb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/copy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ def deepcopy(x, memo=None, _nil=[]):
137137
if y is not _nil:
138138
return y
139139

140-
if cls in _builtin_iterables and not x:
141-
y = cls()
142-
elif copier := _deepcopy_dispatch.get(cls):
140+
copier = _deepcopy_dispatch.get(cls)
141+
if copier is not none:
143142
y = copier(x, memo)
144143
else:
145144
if issubclass(cls, type):

0 commit comments

Comments
 (0)