1
0
forked from VimPlug/jedi

Catch parser errors instead of error recovery when splitting param comments

This commit is contained in:
Dave Halter
2018-03-14 09:49:59 +01:00
parent afda309cb9
commit 13ba74515d
2 changed files with 10 additions and 1 deletions

View File

@@ -89,7 +89,11 @@ def _split_mypy_param_declaration(decl_text):
['foo', 'Bar[baz, biz]'].
"""
node = parse(decl_text).children[0]
try:
node = parse(decl_text, error_recovery=False).children[0]
except ParserSyntaxError:
debug.warning('Comment annotation is not valid Python: %s' % decl_text)
return []
if node.type == 'name':
return [node.get_code().strip()]