@@ -56,11 +56,6 @@ class Error(Exception):
5656 pass
5757error = Error # backward compatibility
5858
59- try :
60- from org .python .core import PyStringMap
61- except ImportError :
62- PyStringMap = None
63-
6459__all__ = ["Error" , "copy" , "deepcopy" ]
6560
6661def copy (x ):
@@ -106,23 +101,18 @@ def copy(x):
106101
107102def _copy_immutable (x ):
108103 return x
109- for t in (type ( None ) , int , float , bool , complex , str , tuple ,
104+ for t in (types . NoneType , int , float , bool , complex , str , tuple ,
110105 bytes , frozenset , type , range , slice , property ,
111- types .BuiltinFunctionType , type (Ellipsis ), type (NotImplemented ),
112- types .FunctionType , weakref .ref ):
113- d [t ] = _copy_immutable
114- t = getattr (types , "CodeType" , None )
115- if t is not None :
106+ types .BuiltinFunctionType , types .EllipsisType ,
107+ types .NotImplementedType , types .FunctionType , types .CodeType ,
108+ weakref .ref ):
116109 d [t ] = _copy_immutable
117110
118111d [list ] = list .copy
119112d [dict ] = dict .copy
120113d [set ] = set .copy
121114d [bytearray ] = bytearray .copy
122115
123- if PyStringMap is not None :
124- d [PyStringMap ] = PyStringMap .copy
125-
126116del d , t
127117
128118def deepcopy (x , memo = None , _nil = []):
@@ -181,9 +171,9 @@ def deepcopy(x, memo=None, _nil=[]):
181171
182172def _deepcopy_atomic (x , memo ):
183173 return x
184- d [type ( None ) ] = _deepcopy_atomic
185- d [type ( Ellipsis ) ] = _deepcopy_atomic
186- d [type ( NotImplemented ) ] = _deepcopy_atomic
174+ d [types . NoneType ] = _deepcopy_atomic
175+ d [types . EllipsisType ] = _deepcopy_atomic
176+ d [types . NotImplementedType ] = _deepcopy_atomic
187177d [int ] = _deepcopy_atomic
188178d [float ] = _deepcopy_atomic
189179d [bool ] = _deepcopy_atomic
@@ -231,8 +221,6 @@ def _deepcopy_dict(x, memo, deepcopy=deepcopy):
231221 y [deepcopy (key , memo )] = deepcopy (value , memo )
232222 return y
233223d [dict ] = _deepcopy_dict
234- if PyStringMap is not None :
235- d [PyStringMap ] = _deepcopy_dict
236224
237225def _deepcopy_method (x , memo ): # Copy instance methods
238226 return type (x )(x .__func__ , deepcopy (x .__self__ , memo ))
@@ -301,4 +289,4 @@ def _reconstruct(x, memo, func, args,
301289 y [key ] = value
302290 return y
303291
304- del types , weakref , PyStringMap
292+ del types , weakref
0 commit comments