Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
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