def _copy_immutable(x):
return x
for t in (type(None), int, float, bool, complex, str, tuple,
- bytes, frozenset, type, range, slice,
+ bytes, frozenset, type, range, slice, property,
types.BuiltinFunctionType, type(Ellipsis), type(NotImplemented),
types.FunctionType, weakref.ref):
d[t] = _copy_immutable
d[types.BuiltinFunctionType] = _deepcopy_atomic
d[types.FunctionType] = _deepcopy_atomic
d[weakref.ref] = _deepcopy_atomic
+d[property] = _deepcopy_atomic
def _deepcopy_list(x, memo, deepcopy=deepcopy):
y = []
42, 2**100, 3.14, True, False, 1j,
"hello", "hello\u1234", f.__code__,
b"world", bytes(range(256)), range(10), slice(1, 10, 2),
- NewStyle, Classic, max, WithMetaclass]
+ NewStyle, Classic, max, WithMetaclass, property()]
for x in tests:
self.assertIs(copy.copy(x), x)
pass
tests = [None, 42, 2**100, 3.14, True, False, 1j,
"hello", "hello\u1234", f.__code__,
- NewStyle, Classic, max]
+ NewStyle, Classic, max, property()]
for x in tests:
self.assertIs(copy.deepcopy(x), x)