You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Black fails to parse format strings (f-strings) where an express
To Reproduce
Default black settings with either of these
f"{""}"
Error
cannot use --safe with this file; failed to parse source file AST: f-string: expecting '}' (, line 1)
This could be caused by running Black with an older Python version that does not support new syntax used in your source file.
f"{'"'}"
Error
Cannot parse: 1:5: f"{'"'}"
f'''{'''"""'''}'''
Error
Cannot parse: 1:8: EOF in multi-line string
Expected behavior
The code can be parsed successfully, just as Python 3.10, 3.11, and 3.12 can successfully evaluate the code.
Environment
Black's version: main and 23.10.1
OS and Python version: Python 3.10, 3.11, and 3.12 on Ubuntu 22.04.2 in WSL
Additional context
Using f"""{""}""" works fine so long as the triple quotes aren't present internally.
The text was updated successfully, but these errors were encountered:
Verified with https://black.vercel.app/?version=main
Describe the bug
Black fails to parse format strings (f-strings) where an express
To Reproduce
Default black settings with either of these
f"{""}"
Error
f"{'"'}"
Error
f'''{'''"""'''}'''
Error
Expected behavior
The code can be parsed successfully, just as Python
3.10
,3.11
, and3.12
can successfully evaluate the code.Environment
main
and23.10.1
3.10
,3.11
, and3.12
onUbuntu 22.04.2
in WSLAdditional context
Using
f"""{""}"""
works fine so long as the triple quotes aren't present internally.The text was updated successfully, but these errors were encountered: