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

Skip to content

Commit 1dca482

Browse files
committed
Somehow, copy() of a classic class object was handled
atomically, but deepcopy() didn't support this at all. I don't see any reason for this, so I'm adding ClassType to the set of types that are deep-copied atomically.
1 parent c06e3ac commit 1dca482

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/copy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def _deepcopy_atomic(x, memo):
220220
pass
221221
d[types.TypeType] = _deepcopy_atomic
222222
d[types.XRangeType] = _deepcopy_atomic
223+
d[types.ClassType] = _deepcopy_atomic
223224

224225
def _deepcopy_list(x, memo):
225226
y = []

Lib/test/test_copy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def f():
239239
pass
240240
tests = [None, 42, 2L**100, 3.14, True, False, 1j,
241241
"hello", u"hello\u1234", f.func_code,
242-
NewStyle, xrange(10)]
242+
NewStyle, xrange(10), Classic]
243243
for x in tests:
244244
self.assert_(copy.deepcopy(x) is x, `x`)
245245

0 commit comments

Comments
 (0)