Skip to content
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

Fix crash on await (a ** b) #3994

Merged
merged 4 commits into from Nov 3, 2023
Merged

Conversation

JelleZijlstra
Copy link
Collaborator

Fixes #3676

async def main():
await (a ** b)

async def main():
Copy link
Collaborator Author

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

@github-actions
Copy link

github-actions bot commented Oct 28, 2023

diff-shades reports zero changes comparing this PR (42a40c7) to main (e2f2bd0).


What is this? | Workflow run | diff-shades documentation

@JelleZijlstra
Copy link
Collaborator Author

This isn't enough, it still crashes on await (a[b] ** c).

@JelleZijlstra JelleZijlstra marked this pull request as draft October 28, 2023 22:41
@JelleZijlstra JelleZijlstra marked this pull request as ready for review October 28, 2023 23:09
ensure_visible(opening_bracket)
ensure_visible(closing_bracket)
# If we are in a nested await then recurse down.
remove_await_parens(bracket_contents)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@hauntsaninja hauntsaninja merged commit c54c213 into psf:main Nov 3, 2023
41 checks passed
@JelleZijlstra JelleZijlstra deleted the awaitparens branch November 3, 2023 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug formatting await (a**b)
2 participants