summaryrefslogtreecommitdiffstats
path: root/Lib/tokenize.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-02-17 21:46:43 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-02-17 21:46:43 (GMT)
commit8c8d77254f651be33c592d8fabf79f23d2301e02 (patch)
tree9195b692c3173bd46b4ed9454ab711c1b5accb54 /Lib/tokenize.py
parent38df2adaeb7b7c0b6477fdc8056fd8d477fd83b4 (diff)
parent5e6db313686c200da425a54d2e0c95fa40107b1d (diff)
downloadcpython-8c8d77254f651be33c592d8fabf79f23d2301e02.zip
cpython-8c8d77254f651be33c592d8fabf79f23d2301e02.tar.gz
cpython-8c8d77254f651be33c592d8fabf79f23d2301e02.tar.bz2
Untokenize, bad assert: Merge with 3.3
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r--Lib/tokenize.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index 7785c98..123e94b 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -229,7 +229,9 @@ class Untokenizer:
def add_whitespace(self, start):
row, col = start
- assert row <= self.prev_row
+ if row < self.prev_row or row == self.prev_row and col < self.prev_col:
+ raise ValueError("start ({},{}) precedes previous end ({},{})"
+ .format(row, col, self.prev_row, self.prev_col))
col_offset = col - self.prev_col
if col_offset:
self.tokens.append(" " * col_offset)