Skip to content

Commit

Permalink
blib2to3: Never put prefixes on DEDENT leaves
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv committed Mar 17, 2018
1 parent 497de7f commit c90cf42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blib2to3/pgen2/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ def parse_tokens(self, tokens, debug=False):
if debug:
self.logger.debug("%s %r (prefix=%r)",
token.tok_name[type], value, prefix)
if type == token.DEDENT:
_prefix = prefix
prefix = ""
if p.addtoken(type, value, (prefix, start)):
if debug:
self.logger.debug("Stop.")
break
prefix = ""
if type == token.DEDENT:
prefix = _prefix
lineno, column = end
if value.endswith("\n"):
lineno += 1
Expand Down

0 comments on commit c90cf42

Please sign in to comment.