Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Lib/test/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -70,9 +70,15 @@ def __reduce__(self):

def test_copy_reduce(self):
class C(object):
def __reduce_ex__(self, proto):
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)
Expand Down Expand Up @@ -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()
Expand All @@ -339,9 +345,15 @@ def __reduce__(self):

def test_deepcopy_reduce(self):
class C(object):
def __reduce_ex__(self, proto):
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)
Expand Down
Loading