diff options
Diffstat (limited to 'sphinx/pycode')
| -rw-r--r-- | sphinx/pycode/pgen2/tokenize.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sphinx/pycode/pgen2/tokenize.py b/sphinx/pycode/pgen2/tokenize.py index 46ee7842..84a9ddcf 100644 --- a/sphinx/pycode/pgen2/tokenize.py +++ b/sphinx/pycode/pgen2/tokenize.py @@ -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) |
