Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Exception in function annotations #200

Description

@chess-equality

I have the following function:

def function8(param: 'int'):
    print "functionAnnotation"

Parsing this with the BblfshClient results in the following exception:

ParseResponse(FATAL,Vector(syntax error: Errors produced trying to get an AST for both Python versions
------ Python2 errors:
[b'Traceback (most recent call last):\n  File "<string>", line 1, in <module>\n  File "/opt/driver/bin/.local/lib/python3.6/site-packages/pydetector/ast2dict.py", line 19, in ast2dict\n    return visitor.parse()\n  File "/opt/driver/bin/.local/lib/python3.6/site-packages/pydetector/ast2dict.py", line 45, in parse\n    tree = ast.parse(self.codestr, mode=\'exec\')\n  File "/usr/lib/python2.7/ast.py", line 37, in parse\n    return compile(source, filename, mode, PyCF_ONLY_AST)\n  File "<unknown>", line 22\n    def function8(param: \'int\'):\n                       ^\nSyntaxError: invalid syntax\n']
------ Python3 errors:
['Traceback (most recent call last):\n  File "/opt/driver/bin/.local/lib/python3.6/site-packages/pydetector/ast_checks.py", line 53, in check_ast\n    current_ast = ast2dict(code)\n  File "/opt/driver/bin/.local/lib/python3.6/site-packages/pydetector/ast2dict.py", line 19, in ast2dict\n    return visitor.parse()\n  File "/opt/driver/bin/.local/lib/python3.6/site-packages/pydetector/ast2dict.py", line 45, in parse\n    tree = ast.parse(self.codestr, mode=\'exec\')\n  File "/usr/local/lib/python3.6/ast.py", line 35, in parse\n    return compile(source, filename, mode, PyCF_ONLY_AST)\n  File "<unknown>", line 2\n    print ""\n           ^\nSyntaxError: Missing parentheses in call to \'print\'. Did you mean print("")?\n']),Some(Duration(0,24164502)),None,python,)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions