[3.12] gh-109195: fix source location for super load before LOAD_SUPER_ATTR (GH-109289) (#109291)

gh-109195: fix source location for super load before LOAD_SUPER_ATTR (GH-109289)
(cherry picked from commit ceeb4173ae)

Co-authored-by: Carl Meyer <carl@oddbird.net>
This commit is contained in:
Miss Islington (bot) 2023-09-12 07:20:41 -07:00 committed by GitHub
parent 8e96b98282
commit 2004e12d8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -1742,6 +1742,13 @@ class TestSourcePositions(unittest.TestCase):
list(code.co_consts[1].co_positions()),
)
def test_load_super_attr(self):
source = "class C:\n def __init__(self):\n super().__init__()"
code = compile(source, "<test>", "exec").co_consts[0].co_consts[1]
self.assertOpcodeSourcePositionIs(
code, "LOAD_GLOBAL", line=3, end_line=3, column=4, end_column=9
)
class TestExpressionStackSize(unittest.TestCase):
# These tests check that the computed stack size for a code object