GH-117750: When clearing object's dict, clear inline values but leave dict attached (GH-117808)

This commit is contained in:
Mark Shannon 2024-04-15 14:45:05 +01:00 committed by GitHub
parent 7d0be7aea5
commit 784e076a10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 15 deletions

View file

@ -862,6 +862,16 @@ class TestInlineValues(unittest.TestCase):
self.assertFalse(has_inline_values(c))
self.check_100(c)
def test_bug_117750(self):
"Aborted on 3.13a6"
class C:
def __init__(self):
self.__dict__.clear()
obj = C()
self.assertEqual(obj.__dict__, {})
obj.foo = None # Aborted here
self.assertEqual(obj.__dict__, {"foo":None})
if __name__ == '__main__':