Skip to content

bpo-33475: Fix and improve converting annotations to strings.#6774

Merged
ambv merged 3 commits into
python:masterfrom
serhiy-storchaka:ast-unparse-omit-parens
May 17, 2018
Merged

bpo-33475: Fix and improve converting annotations to strings.#6774
ambv merged 3 commits into
python:masterfrom
serhiy-storchaka:ast-unparse-omit-parens

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented May 12, 2018

Copy link
Copy Markdown
Member
  • Fix miscellaneous bugs in converting annotations to strings.
  • Optimize parenthesis in the string representation.
  • Clean up the C code.

https://bugs.python.org/issue33475

* Fix miscellaneous bugs in converting annotations to strings.
* Optimize parenthesis in the string representation.
* Clean up the C code.
@gvanrossum

Copy link
Copy Markdown
Member

@ambv should review it

@@ -0,0 +1,2 @@
Fixed miscellaneous bugs in onverting annotations to strings and optimize

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

converting, optimized (to make tense consistent), parentheses (on the next line)

@ambv ambv merged commit 64fddc4 into python:master May 17, 2018
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @serhiy-storchaka for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@ambv

ambv commented May 17, 2018

Copy link
Copy Markdown
Contributor

Thanks for the PR, @serhiy-storchaka! I won't lie, I don't like the macros, I find them hiding actual control flow in the functions. But I won't argue with all the fixes you made.

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @serhiy-storchaka and @ambv, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 64fddc423fcbe90b8088446c63385ec0aaf3077c 3.7

@ambv

ambv commented May 17, 2018

Copy link
Copy Markdown
Contributor

Oops, looks like 3.7 needs help.

@serhiy-storchaka serhiy-storchaka deleted the ast-unparse-omit-parens branch May 17, 2018 06:25
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Thank you for merging the PR and sorry for using macros. My reasons are that they make the code clearer to me they are already used everywhere in the AST processing. In any case this patch changed virtually every line of the code. Macros can help to avoid such large changes in future (if we will add a hidden parameter passed to most functions) or can help to automate changes because they uses are one-line and well searchable.

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request May 17, 2018
…ythonGH-6774).

(cherry picked from commit 64fddc4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-6927 is a backport of this pull request to the 3.7 branch.

serhiy-storchaka added a commit that referenced this pull request May 20, 2018
…H-6774). (GH-6927)

(cherry picked from commit 64fddc4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants