Pablo Galindo Salgado <[email protected]> added the comment:
Seems that I also found this weird behaviour in the old parser:
import ast
code = """\
x = (
'PERL_MM_OPT', (
f'wat'
f'INSTALL-BASE={shlex.quote(venv)} '
f'wat'
),
)
"""
elem = ast.parse(code).body[0].value.elts[1].values[1].value
print(elem)
print(code.split("\n")[elem.lineno-1][elem.col_offset:elem.end_col_offset])
In Python3.8 this prints:
<_ast.Call object at 0x7f7484393a00>
'wat'
which is wrong as the code for that call is certainly not "wat". This happens
in the oldparser in 3.9:
❯ ../3.9/python -Xoldparser lel.py
<ast.Call object at 0x7f78afbc1e10>
'wat'
And something wrong happens in the current master with the new parser:
❯ ../3.9/python lel.py
<ast.Call object at 0x7f504e9a1eb0>
STALL-BASE={shlex
But with PR24067:
<ast.Call object at 0x7fec78673fa0>
shlex.quote(venv)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42806>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com