Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b9def3

Browse files
committed
Add complex to the dispatch tables, to avoid going through the whole
rigmarole of __reduce__.
1 parent 6cef6d5 commit 8b9def3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/copy.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ def _copy_atomic(x):
9696
d[types.IntType] = _copy_atomic
9797
d[types.LongType] = _copy_atomic
9898
d[types.FloatType] = _copy_atomic
99+
try:
100+
d[types.ComplexType] = _copy_atomic
101+
except AttributeError:
102+
pass
99103
d[types.StringType] = _copy_atomic
100104
try:
101105
d[types.UnicodeType] = _copy_atomic
@@ -184,6 +188,10 @@ def _deepcopy_atomic(x, memo):
184188
d[types.IntType] = _deepcopy_atomic
185189
d[types.LongType] = _deepcopy_atomic
186190
d[types.FloatType] = _deepcopy_atomic
191+
try:
192+
d[types.ComplexType] = _deepcopy_atomic
193+
except AttributeError:
194+
pass
187195
d[types.StringType] = _deepcopy_atomic
188196
try:
189197
d[types.UnicodeType] = _deepcopy_atomic

0 commit comments

Comments
 (0)