MCPcopy Index your code
hub / github.com/python/cpython / test_issue24097

Method test_issue24097

Lib/test/test_descr.py:5960–5975  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5958 self._assert_is_copy(obj, objcopy2)
5959
5960 def test_issue24097(self):
5961 # Slot name is freed inside __getattr__ and is later used.
5962 class S(str): # Not interned
5963 pass
5964 class A:
5965 __slotnames__ = [S('spam')]
5966 def __getattr__(self, attr):
5967 if attr == 'spam':
5968 A.__slotnames__[:] = [S('spam')]
5969 return 42
5970 else:
5971 raise AttributeError
5972
5973 import copyreg
5974 expected = (copyreg.__newobj__, (A,), (None, {'spam': 42}), None, None)
5975 self.assertEqual(A().__reduce_ex__(2), expected) # Shouldn't crash
5976
5977 def test_object_reduce(self):
5978 # Issue #29914

Callers

nothing calls this directly

Calls 3

AClass · 0.70
assertEqualMethod · 0.45
__reduce_ex__Method · 0.45

Tested by

no test coverage detected