This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients Anthony Sottile, gvanrossum, lys.nikolaou, pablogsal
Date 2021-01-03.00:19:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609633163.51.0.552592806521.issue42806@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2021-01-03 00:19:23pablogsalsetrecipients: + pablogsal, gvanrossum, Anthony Sottile, lys.nikolaou
2021-01-03 00:19:23pablogsalsetmessageid: <1609633163.51.0.552592806521.issue42806@roundup.psfhosted.org>
2021-01-03 00:19:23pablogsallinkissue42806 messages
2021-01-03 00:19:23pablogsalcreate