Skip to content

Comments

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

Merged
hauntsaninja merged 4 commits intopsf:mainfrom
JelleZijlstra:awaitparens
Nov 3, 2023
Merged

Fix crash on await (a ** b)#3994
hauntsaninja merged 4 commits intopsf:mainfrom
JelleZijlstra:awaitparens

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
@JelleZijlstra JelleZijlstra deleted the awaitparens branch November 3, 2023 03:50
@JelleZijlstra JelleZijlstra restored the awaitparens branch September 10, 2024 23:36
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