mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Changed the tokenizer in pgen2 to add a newline to lines even if it's missing. This makes sure that a file that does not end with a newline is properly parsed.
This commit is contained in:
parent
386548ae19
commit
646840d387
@ -274,6 +274,11 @@ def generate_tokens(readline):
|
||||
line = readline()
|
||||
except StopIteration:
|
||||
line = ''
|
||||
# if we are not at the end of the file make sure the
|
||||
# line ends with a newline because the parser depends
|
||||
# on that.
|
||||
if line:
|
||||
line = line.rstrip() + '\n'
|
||||
lnum = lnum + 1
|
||||
pos, max = 0, len(line)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user