[3.13] gh-122445: populate only modified fields in __static_attributes__ (#122446) (#122621)

gh-122445: populate only modified fields in __static_attributes__ (#122446)

(cherry picked from commit 498376d7a7)
This commit is contained in:
Irit Katriel 2024-08-02 19:26:57 +01:00 committed by GitHub
parent b20893b5c2
commit 545a328eae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 18 deletions

View file

@ -2056,12 +2056,15 @@ class TestSourcePositions(unittest.TestCase):
self.assertLessEqual(end_col, code_end)
class TestExpectedAttributes(unittest.TestCase):
class TestStaticAttributes(unittest.TestCase):
def test_basic(self):
class C:
def f(self):
self.a = self.b = 42
# read fields are not included
self.f()
self.arr[3]
self.assertIsInstance(C.__static_attributes__, tuple)
self.assertEqual(sorted(C.__static_attributes__), ['a', 'b'])