bpo-35224: Add support for NamedExpr to unparse.py#11670
Merged
vstinner merged 1 commit intopython:masterfrom Jan 25, 2019
vstinner:unparse_named_expr
Merged
bpo-35224: Add support for NamedExpr to unparse.py#11670vstinner merged 1 commit intopython:masterfrom vstinner:unparse_named_expr
vstinner merged 1 commit intopython:masterfrom
vstinner:unparse_named_expr
Conversation
2 tasks
Member
Author
|
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). |
Member
Author
|
I tested manually on Linux: " ./python -m test test_tools -u all -v" pass with success. |
Member
Member
Author
|
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 ;-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue35224