Skip to content

Commit 37b18f0

Browse files
committed
Apply review suggestions: shorten NEWS, use class attribute in test
1 parent abc037e commit 37b18f0

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

Lib/test/test_copy.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -941,15 +941,14 @@ def m(self):
941941

942942
def test_deepcopy_memo_none_result(self):
943943
# Objects whose deepcopy result is None must still be memoized.
944-
call_count = 0
945944
class C:
945+
call_count = 0
946946
def __deepcopy__(self, memo):
947-
nonlocal call_count
948-
call_count += 1
947+
C.call_count += 1
949948
return None
950949
obj = C()
951950
copy.deepcopy([obj, obj, obj])
952-
self.assertEqual(call_count, 1)
951+
self.assertEqual(C.call_count, 1)
953952

954953

955954
class TestReplace(unittest.TestCase):
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
Fix :func:`copy.deepcopy` so that an object whose deep copy is ``None`` is
2-
still memoized. The memo miss was detected with ``None``, which is a valid
3-
result, so such objects were copied again on every reference. Patch by
4-
tonghuaroot.
2+
still memoized. Patch by tonghuaroot.

0 commit comments

Comments
 (0)