mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
SF bug #1224621: tokenize module does not detect inconsistent dedents
This commit is contained in:
parent
8fa7eb563b
commit
da99d1cbfe
3 changed files with 25 additions and 1 deletions
|
@ -271,6 +271,9 @@ def generate_tokens(readline):
|
|||
indents.append(column)
|
||||
yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line)
|
||||
while column < indents[-1]:
|
||||
if column not in indents:
|
||||
raise IndentationError(
|
||||
"unindent does not match any outer indentation level")
|
||||
indents = indents[:-1]
|
||||
yield (DEDENT, '', (lnum, pos), (lnum, pos), line)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue