Commit e2a245cb authored by Jelle Zijlstra's avatar Jelle Zijlstra

f-string parsing: fix bugs

parent 1af7483c
...@@ -898,7 +898,7 @@ def p_string_literal(s, kind_override=None): ...@@ -898,7 +898,7 @@ def p_string_literal(s, kind_override=None):
else: else:
if kind_override is not None and kind_override in 'ub': if kind_override is not None and kind_override in 'ub':
kind = kind_override kind = kind_override
if kind in 'uf': # f-strings are scanned exactly like Unicode literals, but are parsed further later if kind in {'u', 'f'}: # f-strings are scanned exactly like Unicode literals, but are parsed further later
chars = StringEncoding.UnicodeLiteralBuilder() chars = StringEncoding.UnicodeLiteralBuilder()
elif kind == '': elif kind == '':
chars = StringEncoding.StrLiteralBuilder(s.source_encoding) chars = StringEncoding.StrLiteralBuilder(s.source_encoding)
...@@ -1122,7 +1122,7 @@ def p_f_string_expr(s, unicode_value, pos, starting_index): ...@@ -1122,7 +1122,7 @@ def p_f_string_expr(s, unicode_value, pos, starting_index):
# the format spec is itself treated like an f-string # the format spec is itself treated like an f-string
if format_spec_str is not None: if format_spec_str is not None:
format_spec = p_f_string(s, format_spec_str, pos) format_spec = ExprNodes.JoinedStrNode(pos, values = p_f_string(s, format_spec_str, pos))
else: else:
format_spec = None format_spec = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment