-
- Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
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)
Linked PRs
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error