◐ Shell
clean mode source ↗

bpo-16806: Fix `lineno` and `col_offset` for multi-line string tokens. by asottile · Pull Request #10021 · python/cpython

I suspect this was incorrect before (being adjusted by -1 due to the multiline string).

$ python ~/workspace/astpretty/astpretty.py t.py 
Module(
    body=[
        Assign(
            lineno=1,
            col_offset=0,
            targets=[Name(lineno=1, col_offset=0, id='x', ctx=Store())],
            value=BinOp(
                lineno=1,
                col_offset=4,
                left=Num(lineno=1, col_offset=4, n=1),
                op=Add(),
                right=Num(lineno=1, col_offset=8, n=1),
            ),
        ),
    ],
)