classification
Title: lib2to3 fails to parse a ** of a conditional expression
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, gregory.p.smith, xtreak
Priority: normal Keywords:

Created on 2018-01-04 23:28 by gregory.p.smith, last changed 2018-09-14 09:03 by xtreak.

Files
File name Uploaded Description Edit
repro_2to3_prob.py gregory.p.smith, 2018-01-04 23:28
Messages (1)
msg309488 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-01-04 23:28
see the attached sample code demonstrating the problem.

basically lib2to3 fails to parse:

  dummy(**kwargs if kwargs else dict())

with an error like:

    raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=1, value='if', context=(' ', (3, 21))
History
Date User Action Args
2018-09-14 09:03:31xtreaksetnosy: + xtreak
2018-01-04 23:49:12serhiy.storchakasetnosy: + benjamin.peterson
2018-01-04 23:28:09gregory.p.smithcreate