bpo-35224: Add support for NamedExpr to unparse.py#11670
Conversation
|
Oh, my first attempt without parenthesis failed: "(x := 1)" became "x := 1" which raises a SyntaxError. I modified my PR to always add parenthesis. I will push this change to repair buildbots. If someone finds a smarter solution to omit parenthesis in some cases, please go ahead. I never used unparse.py. I don't think that it should nor that it can produce exactly the same input file, since Python looses many formatting information with code is compiled to bytecode (or even just when compiled to AST). |
Sorry, something went wrong.
|
I tested manually on Linux: " ./python -m test test_tools -u all -v" pass with success. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Example: There are useless parentheses, but as I wrote, it's hard to emit the perfect code only from AST. And I wrote a quick fix to repair the CI ;-) |
Sorry, something went wrong.
https://bugs.python.org/issue35224