py/lexer: Wrap in parenthesis all f-string arguments passed to format.
This is important for literal tuples, e.g.
f"{a,b,}, {c}" --> "{}".format((a,b), (c),)
which would otherwise result in either a syntax error or the wrong result.
Fixes issue #9635.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
committed by
Damien George
parent
5c4153ea37
commit
fb8792c095
@@ -21,3 +21,7 @@ print(f"a {x=:08x} b {y} c")
|
||||
|
||||
print(f'a {f() + g("foo") + h()=} b')
|
||||
print(f'a {f() + g("foo") + h()=:08x} b')
|
||||
|
||||
print(f"a {1,=} b")
|
||||
print(f"a {x,y,=} b")
|
||||
print(f"a {x,1=} b")
|
||||
|
||||
Reference in New Issue
Block a user