summaryrefslogtreecommitdiff
path: root/Lib/tokenize.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r--Lib/tokenize.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index d7043b1bc3..fdc5cbfb41 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -178,6 +178,7 @@ class Untokenizer:
tokval += ' '
if toknum in (NEWLINE, NL):
startline = True
+ prevstring = False
for tok in iterable:
toknum, tokval = tok[:2]
if toknum == ENCODING:
@@ -187,6 +188,14 @@ class Untokenizer:
if toknum in (NAME, NUMBER):
tokval += ' '
+ # Insert a space between two consecutive strings
+ if toknum == STRING:
+ if prevstring:
+ tokval = ' ' + tokval
+ prevstring = True
+ else:
+ prevstring = False
+
if toknum == INDENT:
indents.append(tokval)
continue