summaryrefslogtreecommitdiffstats
path: root/Lib/tokenize.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-06-21 07:53:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-06-21 07:53:56 (GMT)
commit1ec9c52de39a94fb6607f8698c9309129ac471f0 (patch)
tree924d3d863464395d90ec8e1dc08fa05bfc478d3d /Lib/tokenize.py
parent8f7dce605fefb605da4c732bdaffd01e5246362a (diff)
downloadcpython-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.py3
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)