Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ast.unparse is not working correctly for strings with multiple quotes #108843

Closed
Labels
3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@sunmy2019

Description

@sunmy2019

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.

importasts="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:unterminatedtriple-quotedstringliteral (detectedatline1)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp