From f5f296cf32c27be6a970e4c568450846f3f01be5 Mon Sep 17 00:00:00 2001 From: David Slavicek Date: Sun, 19 Jul 2026 19:54:36 +0200 Subject: [PATCH] improve test_copy_reduce and test_deepcopy_reduce coverage --- Lib/test/test_copy.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index 98f56b5ae87f96..71bbccbe32be58 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -73,6 +73,10 @@ class C(object): 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) @@ -342,6 +346,10 @@ class C(object): 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)