New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ast.unparse: Wrong unparse with something like "() = []". #92671
Comments
Reproduced, and confirmed that these work fine on 3.10. This one does work correctly on 3.12: >>> import ast
>>> ast.unparse(ast.parse("[] = ()"))
'[] = ()' cc. @pablogsal, @isidentical |
isidentical
added a commit
to isidentical/cpython
that referenced
this issue
May 11, 2022
It's not the same. The tuple must be on the left. >>> import ast
>>> ast.unparse(ast.parse("() = []"))
' = []' |
pablogsal
pushed a commit
that referenced
this issue
May 16, 2022
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 16, 2022
…ythonGH-92673) (cherry picked from commit f6fd8aa) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
miss-islington
added a commit
that referenced
this issue
May 16, 2022
Fixed in #92673, and backported to 3.11. Thanks for the report, @NIKDISSV-Forever. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NIKDISSV-Forever commentedMay 11, 2022
Generates incorrect code if unparse passes an assignment with an empty tuple on the left side.
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
The text was updated successfully, but these errors were encountered: