@@ -100,14 +100,14 @@ def copy(x):
100
100
return _reconstruct (x , None , * rv )
101
101
102
102
103
- _copy_atomic_types = {types .NoneType , int , float , bool , complex , str , tuple ,
103
+ _copy_atomic_types = frozenset ( {types .NoneType , int , float , bool , complex , str , tuple ,
104
104
bytes , frozenset , type , range , slice , property ,
105
105
types .BuiltinFunctionType , types .EllipsisType ,
106
106
types .NotImplementedType , types .FunctionType , types .CodeType ,
107
- weakref .ref , super }
108
- _copy_builtin_containers = {list , dict , set , bytearray }
107
+ weakref .ref , super })
108
+ _copy_builtin_containers = frozenset ( {list , dict , set , bytearray })
109
109
110
- def deepcopy (x , memo = None , _nil = [] ):
110
+ def deepcopy (x , memo = None ):
111
111
"""Deep copy operation on arbitrary Python objects.
112
112
113
113
See the module's __doc__ string for more info.
@@ -122,8 +122,8 @@ def deepcopy(x, memo=None, _nil=[]):
122
122
if memo is None :
123
123
memo = {}
124
124
else :
125
- y = memo .get (d , _nil )
126
- if y is not _nil :
125
+ y = memo .get (d , None )
126
+ if y is not None :
127
127
return y
128
128
129
129
copier = _deepcopy_dispatch .get (cls )
@@ -162,9 +162,9 @@ def deepcopy(x, memo=None, _nil=[]):
162
162
_keep_alive (x , memo ) # Make sure x lives at least as long as d
163
163
return y
164
164
165
- _atomic_types = {types .NoneType , types .EllipsisType , types .NotImplementedType ,
165
+ _atomic_types = frozenset ( {types .NoneType , types .EllipsisType , types .NotImplementedType ,
166
166
int , float , bool , complex , bytes , str , types .CodeType , type , range ,
167
- types .BuiltinFunctionType , types .FunctionType , weakref .ref , property }
167
+ types .BuiltinFunctionType , types .FunctionType , weakref .ref , property })
168
168
169
169
_deepcopy_dispatch = d = {}
170
170
0 commit comments