-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expose more information about function line numbers #50
Comments
Whatever solution we pick should also be applied to decorated classes. |
In python/mypy#3871 we seem to be of the opinion that adding |
To be clear, I am adding this to |
It appears this was fixed in python/cpython#9731. Perhaps we could backport that change after the update to being based on the 3.7 ast? |
Taking into account size of the fix, can we backport just the fix now? Supporting 3.7 in |
Sure, I'd be happy to make a PR. |
OK, let's do this then. |
So... It looks like we took a different path. In Python 3.8's ast this is fixed, but it was not fixed in Python 3.7's ast. Typed_ast is now based on Python 3.7's ast. Should we do it or not? I worry that just changing the lineno attribute of FunctionDef and ClassDef nodes will break tons of users' code since it changes where |
Let's leave typed_ast alone. With Python 3.8 we can support |
In hopes of solving python/mypy#3871 we probably need to modify typed_ast to expose more information about function line numbers.
If the return type annotation of a function is absent, the
FunctionDef
node will havereturns
asNone
, which means mypy cannot get the line number of where the return type annotation should be. Additionally the actualdef
line number may be impossible to calculate based on given ast data.The text was updated successfully, but these errors were encountered: