https://github.com/python/cpython/commit/5f6e39a3999f83ca5088d325eb000c6c378b722d commit: 5f6e39a3999f83ca5088d325eb000c6c378b722d branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2026-08-27T15:59:30+03:00 summary:
[3.15] improve test_copy_reduce and test_deepcopy_reduce coverage (GH-154182) (#155792) Co-authored-by: David <[email protected]> Co-authored-by: Tomas R. <[email protected]> files: M Lib/test/test_copy.py diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index 9455c9e00514ca..13b7ce29565dee 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -60,7 +60,7 @@ class C(object): def __reduce_ex__(self, proto): c.append(1) return "" - def __reduce__(self): + def __reduce__(*args): self.fail("shouldn't call this") c = [] x = C() @@ -70,9 +70,15 @@ def __reduce__(self): def test_copy_reduce(self): class C(object): + def __reduce_ex__(*args): + self.fail("shouldn't call this") def __reduce__(self): c.append(1) return "" + def __getattribute__(self, name): + if name == "__reduce_ex__": + raise AttributeError(name) + return object.__getattribute__(self, name) c = [] x = C() y = copy.copy(x) @@ -329,7 +335,7 @@ class C(object): def __reduce_ex__(self, proto): c.append(1) return "" - def __reduce__(self): + def __reduce__(*args): self.fail("shouldn't call this") c = [] x = C() @@ -339,9 +345,15 @@ def __reduce__(self): def test_deepcopy_reduce(self): class C(object): + def __reduce_ex__(*args): + self.fail("shouldn't call this") def __reduce__(self): c.append(1) return "" + def __getattribute__(self, name): + if name == "__reduce_ex__": + raise AttributeError(name) + return object.__getattribute__(self, name) c = [] x = C() y = copy.deepcopy(x) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
