mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
Merge with 3.3
This commit is contained in:
commit
40f8c6774b
2 changed files with 22 additions and 1 deletions
|
@ -234,6 +234,10 @@ class Untokenizer:
|
|||
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))
|
||||
row_offset = row - self.prev_row
|
||||
if row_offset:
|
||||
self.tokens.append("\\\n" * row_offset)
|
||||
self.prev_col = 0
|
||||
col_offset = col - self.prev_col
|
||||
if col_offset:
|
||||
self.tokens.append(" " * col_offset)
|
||||
|
@ -248,6 +252,8 @@ class Untokenizer:
|
|||
if tok_type == ENCODING:
|
||||
self.encoding = token
|
||||
continue
|
||||
if tok_type == ENDMARKER:
|
||||
break
|
||||
self.add_whitespace(start)
|
||||
self.tokens.append(token)
|
||||
self.prev_row, self.prev_col = end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue