-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Generates incorrect code if unparse passes an assignment with an empty tuple on the left side.
import ast
ast.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
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error