allow trailing comma <3.6, test both postive/negative cases

This commit is contained in:
Batuhan Taskaya committed 2020-05-23 17:45:20 +03:00
1 parent fe54800cdd
commit 92396a9a16
2 files changed
+24 -10

No files matched your search

+12 -3
View File
@@ -800,9 +800,18 @@ class _ArglistRule(SyntaxRule):
if argument.type == 'argument':
first = argument.children[0]
if argument.children[1].type in _COMP_FOR_TYPES and len(node.children) >= 2:
# a(a, b for b in c)
return True
if (
argument.children[1].type in _COMP_FOR_TYPES
and len(node.children) >= 2
):
if self._normalizer.version >= (3, 7):
return True
elif len(node.children) == 2 and node.children[1] == ",":
# trailing comma allowed until 3.7
pass
else:
return True
if first in ('*', '**'):
if first == '*':
if kw_unpacking_only: