Issue 32496: lib2to3 fails to parse a ** of a conditional expression
Created on 2018-01-04 23:28 by gregory.p.smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| repro_2to3_prob.py | gregory.p.smith, 2018-01-04 23:28 | |||
| Messages (2) | |||
|---|---|---|---|
| msg309488 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
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))
|
|||
| msg333641 - (view) | Author: Ori Avtalion (salty-horse) * | Date: 2019-01-14 20:41 | |
This can be circumvented by adding parenthesis: dummy(**(kwargs if kwargs else dict())) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:56 | admin | set | github: 76677 |
| 2019-10-24 05:56:26 | gregory.p.smith | set | status: open -> closed superseder: lib2to3 doesn't parse f(*[] or []) stage: resolved resolution: duplicate versions: + Python 3.8, Python 3.9, - Python 3.6 |
| 2019-01-14 20:41:16 | salty-horse | set | nosy:
+ salty-horse messages: + msg333641 |
| 2018-09-14 09:03:31 | xtreak | set | nosy:
+ xtreak |
| 2018-01-04 23:49:12 | serhiy.storchaka | set | nosy:
+ benjamin.peterson |
| 2018-01-04 23:28:09 | gregory.p.smith | create | |
