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.
There seems to be a case where ParseError will report the line number after the last line number, causing an IndexError in retype:
Example file (core.py):
def get_message():
return '123'
Example stub (types/core.pyi):
def get_message() -> str: ...
$>retype --traceback core.py
error: core.py: list index out of range
Traceback (most recent call last):
File "retype.py", line 110, in retype_path
retype_file(src, pyi_dir, targets, quiet=quiet, hg=hg)
File "retype.py", line 132, in retype_file
src_node = lib2to3_parse(src_txt)
File "retype.py", line 161, in lib2to3_parse
faulty_line = src_txt.splitlines()[lineno - 1]
IndexError: list index out of range
I haven't gone digging yet to see why the Driver is failing to parse this, but it seems that this should be fixed as well.
Tested using:
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Python 3.6.1 (default, May 11 2017, 22:14:44) [GCC 4.9.2] on linux
The text was updated successfully, but these errors were encountered:
* - Added handling for cases where the ParseError refers to lines that don't exist in the source.
- Specifically handling the missing newline case, because it is especially difficult to diagnose.
There seems to be a case where
ParseError
will report the line number after the last line number, causing anIndexError
in retype:Example file (core.py):
Example stub (types/core.pyi):
I haven't gone digging yet to see why the
Driver
is failing to parse this, but it seems that this should be fixed as well.Tested using:
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Python 3.6.1 (default, May 11 2017, 22:14:44) [GCC 4.9.2] on linux
The text was updated successfully, but these errors were encountered: