diff options
author | Raymond Hettinger <python@rcn.com> | 2005-06-21 07:53:56 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-06-21 07:53:56 (GMT) |
commit | 1ec9c52de39a94fb6607f8698c9309129ac471f0 (patch) | |
tree | 924d3d863464395d90ec8e1dc08fa05bfc478d3d /Lib/tokenize.py | |
parent | 8f7dce605fefb605da4c732bdaffd01e5246362a (diff) | |
download | cpython-1ec9c52de39a94fb6607f8698c9309129ac471f0.zip cpython-1ec9c52de39a94fb6607f8698c9309129ac471f0.tar.gz cpython-1ec9c52de39a94fb6607f8698c9309129ac471f0.tar.bz2 |
SF bug #1224621: tokenize module does not detect inconsistent dedents
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r-- | Lib/tokenize.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py index 9087e84..fc97a28 100644 --- a/Lib/tokenize.py +++ b/Lib/tokenize.py @@ -225,6 +225,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) |