Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LOAD_GLOBAL super reports wrong source positions #109195

Closed
Assignees
carljm
Labels
3.12only security fixestype-bugAn unexpected behavior, bug, or error
@15r10nk

Description

@15r10nk

Bug report

Bug description:

LOAD_GLOBAL super includes the paranthesis ofsuper() in the source positions.

script:

importdissource="""class VerifierFailure:    def __init__(self):        super().__init__"""code=compile(source,"<file>","exec")bc=code.co_consts[0].co_consts[1]load_global=list(dis.Bytecode(bc))[2]dis.dis(bc)print(load_global)assertload_global.positions.end_col_offset==13

output (Python 3.12.0rc2+):

0COPY_FREE_VARS142RESUME054LOAD_GLOBAL0 (super)14LOAD_DEREF1 (__class__)16LOAD_FAST0 (self)18LOAD_SUPER_ATTR4 (__init__)22POP_TOP24RETURN_CONST0 (None)Instruction(opname='LOAD_GLOBAL',opcode=116,arg=0,argval='super',argrepr='super',offset=4,starts_line=5,is_jump_target=False,positions=Positions(lineno=5,end_lineno=5,col_offset=8,end_col_offset=15))Traceback (mostrecentcalllast):File"/home/frank/projects/cpython/../executing/bug.py",line21,in<module>assertload_global.positions.end_col_offset==13AssertionError

I bisected this problem down to0dc8b50

I hope that it is possible to restore the old source positions. I work currently on python 3.12 support forexecuting, which relies on correct source positions to perform a correct bytecode -> AST mapping.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp