closes bpo-27494: Fix 2to3 handling of trailing comma after a generator expression (#3771)

This commit is contained in:
Jakub Stasiak 2017-10-05 09:10:09 +02:00 committed by Benjamin Peterson
parent a8ed11742b
commit af810b35b4
7 changed files with 38 additions and 10 deletions

View file

@ -101,8 +101,8 @@ def ListComp(xp, fp, it, test=None):
test.prefix = " "
if_leaf = Leaf(token.NAME, "if")
if_leaf.prefix = " "
inner_args.append(Node(syms.comp_if, [if_leaf, test]))
inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)])
inner_args.append(Node(syms.old_comp_if, [if_leaf, test]))
inner = Node(syms.listmaker, [xp, Node(syms.old_comp_for, inner_args)])
return Node(syms.atom,
[Leaf(token.LBRACE, "["),
inner,
@ -208,7 +208,7 @@ def attr_chain(obj, attr):
next = getattr(next, attr)
p0 = """for_stmt< 'for' any 'in' node=any ':' any* >
| comp_for< 'for' any 'in' node=any any* >
| old_comp_for< 'for' any 'in' node=any any* >
"""
p1 = """
power<