diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-05-30 21:10:46 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-30 21:10:46 (GMT) |
| commit | 5fff491bd5d6da579a28b521efd3ef15f3f42c01 (patch) | |
| tree | 46c2f088c59144bbe9d72224f3c30de722f07d2b /Lib/test/test_super.py | |
| parent | 9ae49e3f3bdf585473f03522a1b7dd7c9e4baa6a (diff) | |
| download | cpython-5fff491bd5d6da579a28b521efd3ef15f3f42c01.zip cpython-5fff491bd5d6da579a28b521efd3ef15f3f42c01.tar.gz cpython-5fff491bd5d6da579a28b521efd3ef15f3f42c01.tar.bz2 | |
[3.12] gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094) (#105117)
gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094)
(cherry picked from commit 68c75c31536e8c87901934f2d6da81f54f4334f9)
Co-authored-by: Carl Meyer <carl@oddbird.net>
Diffstat (limited to 'Lib/test/test_super.py')
| -rw-r--r-- | Lib/test/test_super.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py index 698ab48..664cf70 100644 --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -410,6 +410,18 @@ class TestSuper(unittest.TestCase): self.assertEqual(C().method(), mysuper) + def test_unusual_getattro(self): + class MyType(type): + pass + + def test(name): + mytype = MyType(name, (MyType,), {}) + super(MyType, type(mytype)).__setattr__(mytype, "bar", 1) + self.assertEqual(mytype.bar, 1) + + test("foo1") + test("foo2") + if __name__ == "__main__": unittest.main() |
