@@ -101,13 +101,11 @@ def copy(x):
101
101
102
102
def _copy_immutable (x ):
103
103
return x
104
- for t in (type ( None ) , int , float , bool , complex , str , tuple ,
104
+ for t in (types . NoneType , int , float , bool , complex , str , tuple ,
105
105
bytes , frozenset , type , range , slice , property ,
106
- types .BuiltinFunctionType , type (Ellipsis ), type (NotImplemented ),
107
- types .FunctionType , weakref .ref ):
108
- d [t ] = _copy_immutable
109
- t = getattr (types , "CodeType" , None )
110
- if t is not None :
106
+ types .BuiltinFunctionType , types .EllipsisType ,
107
+ types .NotImplementedType , types .FunctionType , types .CodeType ,
108
+ weakref .ref ):
111
109
d [t ] = _copy_immutable
112
110
113
111
d [list ] = list .copy
@@ -173,9 +171,9 @@ def deepcopy(x, memo=None, _nil=[]):
173
171
174
172
def _deepcopy_atomic (x , memo ):
175
173
return x
176
- d [type ( None ) ] = _deepcopy_atomic
177
- d [type ( Ellipsis ) ] = _deepcopy_atomic
178
- d [type ( NotImplemented ) ] = _deepcopy_atomic
174
+ d [types . NoneType ] = _deepcopy_atomic
175
+ d [types . EllipsisType ] = _deepcopy_atomic
176
+ d [types . NotImplementedType ] = _deepcopy_atomic
179
177
d [int ] = _deepcopy_atomic
180
178
d [float ] = _deepcopy_atomic
181
179
d [bool ] = _deepcopy_atomic
0 commit comments