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: Wrong unparse with something like "() = []". #92671

Closed
Labels
3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error
@NIKDISSV-Forever

Description

@NIKDISSV-Forever

Generates incorrect code if unparse passes an assignment with an empty tuple on the left side.

importastast.unparse(ast.parse("() = []"))# " = []"ast.unparse(ast.parse("[] = () = []"))# "[] = = []"

The simplest solution would be to remove the line
self.set_precedence(_Precedence.TUPLE, target)
in ast._Unparser.visit_Assign

Doesn't work properly in 3.11.0b1, 3.12.0a0
In 3.9.12, 3.10.4 - works correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixestype-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