Fix a case with errors

This commit is contained in:
Dave Halter
2019-07-09 00:04:53 -07:00
parent 01cec186ae
commit 374721b789
2 changed files with 10 additions and 1 deletions

View File

@@ -263,8 +263,13 @@ def _iter_arguments(nodes, position):
stars_seen = 0
elif node.type in ('testlist', 'testlist_star_expr'): # testlist is Python 2
for n in node.children[::2]:
if n.type == 'star_expr':
stars_seen = 1
n = n.children[1]
yield stars_seen, remove_after_pos(n), False
stars_seen = 0
# The count of children is even if there's a comma at the end.
previous_node_yielded = bool(len(node.children) % 2)
elif isinstance(node, tree.PythonLeaf) and node.value == ',':
if not previous_node_yielded:
yield stars_seen, '', False

View File

@@ -478,7 +478,11 @@ _calls = [
# Error nodes
(code4, 'i(1, [a,b', 1),
(code4, 'i(1, [a,b=,', 2),
(code4, 'i(1, [a!b,', 2),
(code4, 'i(1, [a?b,', 2),
(code4, 'i(1, [a?b,*', 2),
(code4, 'i(?b,*r,c', 1),
(code4, 'i(?*', 0),
(code4, 'i(?**', 1),
]