mirror of
https://github.com/davidhalter/parso.git
synced 2026-10-21 04:37:04 +08:00
Fix a Python 2 related issue.
This commit is contained in:
1 parent
83d9abd036
commit
d3fa7e1cad
1 file changed
+4
-2
@@ -477,7 +477,9 @@ def tokenize_lines(lines, version_info, start_pos=(1, 0)):
|
|||||||
yield PythonToken(NUMBER, token, spos, prefix)
|
yield PythonToken(NUMBER, token, spos, prefix)
|
||||||
elif initial in '\r\n':
|
elif initial in '\r\n':
|
||||||
if any(not f.allow_multiline() for f in fstring_stack):
|
if any(not f.allow_multiline() for f in fstring_stack):
|
||||||
fstring_stack.clear()
|
# Would use fstring_stack.clear, but that's not available
|
||||||
|
# in Python 2.
|
||||||
|
fstring_stack[:] = []
|
||||||
|
|
||||||
if not new_line and paren_level == 0 and not fstring_stack:
|
if not new_line and paren_level == 0 and not fstring_stack:
|
||||||
yield PythonToken(NEWLINE, token, spos, prefix)
|
yield PythonToken(NEWLINE, token, spos, prefix)
|
||||||
@@ -516,7 +518,7 @@ def tokenize_lines(lines, version_info, start_pos=(1, 0)):
|
|||||||
yield PythonToken(FSTRING_START, token, spos, prefix)
|
yield PythonToken(FSTRING_START, token, spos, prefix)
|
||||||
elif is_identifier(initial): # ordinary name
|
elif is_identifier(initial): # ordinary name
|
||||||
if token in always_break_tokens:
|
if token in always_break_tokens:
|
||||||
fstring_stack.clear()
|
fstring_stack[:] = []
|
||||||
paren_level = 0
|
paren_level = 0
|
||||||
while True:
|
while True:
|
||||||
indent = indents.pop()
|
indent = indents.pop()
|
||||||
|
|||||||
Reference in new issue
Block a user