diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index 3227d108..ecc7528a 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -1128,7 +1128,7 @@ isinstance(c, (tokenize.Token, Operator)) else unicode(c) elif tok_str == '.': if result and isinstance(result[-1], StatementElement): is_chain = True - elif tok_str == ',': # implies a tuple + elif tok_str == ',' and result: # implies a tuple # expression is now an array not a statement anymore stmt = Statement(self._sub_module, result, result[0].start_pos, tok.end_pos, self.parent, set_name_parents=False) diff --git a/test/completion/invalid.py b/test/completion/invalid.py index 18233c20..5d4a8004 100644 --- a/test/completion/invalid.py +++ b/test/completion/invalid.py @@ -168,7 +168,11 @@ invalid = .call #? str() invalid -call = '' invalid = call?.call #? str() invalid + +# comma +invalid = ,call +#? str() +invalid