You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 5, 2023. It is now read-only.
In the PR adding per-argument type comment support #5 there is an unhandled case when comma for an argument is after the type comment, therefore the current version of typed_ast errors out on the following.
In [1]: import inspect
In [2]: import typed_ast.ast3
In [3]: def lovely(spam # type: bool
...: , eggs # type: int
...: , ham # type: str
...: ):
...: # type: (...) -> bool
...: return spam
...:
In [4]: typed_ast.ast3.parse(inspect.getsource(lovely))
File "<unknown>", line 2
, eggs # type: int
^
SyntaxError: invalid syntax
Are there any plans to support this case?
In [5]: import ast
In [6]: ast.parse(inspect.getsource(lovely))
Out[6]: <_ast.Module at 0x7fb9584b84e0>
The built-in ast succeeds, which seems to be in conflict with the development philosophy of typed_ast.
This project is a drop-in replacement for the builtin ast module. It is intended to be bug-for-bug compatible and behave identically, except for the presence of a few additional fields on the returned classes and a few additional optional arguments to the parse call.