Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
In accordance withPEP 701, the following code works:
>>> x=1>>>f"___{... x... }___"'___1___'>>>f"___{(... x... )}___"'___1___'
But the following fails:
f"__{x:d}__"
This gives:
File "<stdin>", line 1 x:dSyntaxError: unterminated f-string literal (detected at line 2)Is this intended behaviour? This is not clarified in the PEP.
Similarly,
f"""__{x:d}__"""
Gives:
Traceback (most recent call last): File "<stdin>", line 1, in <module>ValueError: Invalid format specifier 'd' for object of type 'int'CPython versions tested on:
3.12
Operating systems tested on:
macOS