@@ -60,7 +60,7 @@ class C(object):
6060 def __reduce_ex__ (self , proto ):
6161 c .append (1 )
6262 return ""
63- def __reduce__ (self ):
63+ def __reduce__ (* args ):
6464 self .fail ("shouldn't call this" )
6565 c = []
6666 x = C ()
@@ -70,9 +70,15 @@ def __reduce__(self):
7070
7171 def test_copy_reduce (self ):
7272 class C (object ):
73+ def __reduce_ex__ (* args ):
74+ self .fail ("shouldn't call this" )
7375 def __reduce__ (self ):
7476 c .append (1 )
7577 return ""
78+ def __getattribute__ (self , name ):
79+ if name == "__reduce_ex__" :
80+ raise AttributeError (name )
81+ return object .__getattribute__ (self , name )
7682 c = []
7783 x = C ()
7884 y = copy .copy (x )
@@ -329,7 +335,7 @@ class C(object):
329335 def __reduce_ex__ (self , proto ):
330336 c .append (1 )
331337 return ""
332- def __reduce__ (self ):
338+ def __reduce__ (* args ):
333339 self .fail ("shouldn't call this" )
334340 c = []
335341 x = C ()
@@ -339,9 +345,15 @@ def __reduce__(self):
339345
340346 def test_deepcopy_reduce (self ):
341347 class C (object ):
348+ def __reduce_ex__ (* args ):
349+ self .fail ("shouldn't call this" )
342350 def __reduce__ (self ):
343351 c .append (1 )
344352 return ""
353+ def __getattribute__ (self , name ):
354+ if name == "__reduce_ex__" :
355+ raise AttributeError (name )
356+ return object .__getattribute__ (self , name )
345357 c = []
346358 x = C ()
347359 y = copy .deepcopy (x )
0 commit comments