-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix crash on await (a ** b) #3994
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
Conversation
async def main(): | ||
await (a ** b) | ||
|
||
async def main(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two cases were already fine, but I added them for completeness
This isn't enough, it still crashes on |
src/black/linegen.py
Outdated
ensure_visible(opening_bracket) | ||
ensure_visible(closing_bracket) | ||
# If we are in a nested await then recurse down. | ||
remove_await_parens(bracket_contents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we need to manually make this recursive call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we don't, all the tests pass if I remove it. We'll visit nested awaits anyway because this is invoked from a visitor. It also isn't necessary for removing multiple pairs of parens; we have tests for that.
Fixes #3676