This commit is contained in:
Furkan Onder 2025-12-08 06:12:01 +02:00 committed by GitHub
commit de9833efff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 0 deletions

View file

@ -767,6 +767,18 @@ class C(list):
self.assertIsNot(x[0], y[0])
self.assertIsNot(x.foo, y.foo)
class L(list):
def __getstate__(self):
return list(self)
def __setstate__(self, state):
self[:] = state
l1 = L([1, 2])
l2 = copy.deepcopy(l1)
self.assertEqual(l1, l2)
self.assertEqual(len(l1), len(l2))
def test_copy_tuple_subclass(self):
class C(tuple):
pass