Closed
Description
Bug report
CPython versions tested on:
3.11
Operating systems tested on:
macOS
A clear and concise description of the bug:
During the implementation of #108553, I discovered this bug in the original implementation.
Due to the new syntax, the fix for 3.12 above cannot be reused for 3.11 and below.
import ast
s = "f\"'''{1}\\\"\\\"\\\"\" "
print(s)
eval(s)
s = ast.parse(s)
s1 = ast.unparse(s)
print(s1)
eval(s1)
output:
f"'''{1}\"\"\""
f''''{1}"""'
Traceback (most recent call last):
File "/Users/xxx/work/cpython/a.py", line 10, in <module>
eval(s1)
File "<string>", line 1
f''''{1}"""'
^
SyntaxError: unterminated triple-quoted string literal (detected at line 1)