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

Preview style: Crash on walrus in with statement #3472

Closed
JelleZijlstra opened this issue Dec 25, 2022 · 2 comments · Fixed by #3473
Closed

Preview style: Crash on walrus in with statement #3472

JelleZijlstra opened this issue Dec 25, 2022 · 2 comments · Fixed by #3473
Assignees
Labels
C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. F: parentheses Too many parentheses, not enough parentheses, and so on. T: bug Something isn't working

Comments

@JelleZijlstra
Copy link
Collaborator

This crashes in 23.1a1:

async def f():
    with (x := await sleep(0)):
        pass

Reported by @Zac-HD in #3407 (comment).

@JelleZijlstra JelleZijlstra added T: bug Something isn't working C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. F: parentheses Too many parentheses, not enough parentheses, and so on. labels Dec 25, 2022
@JelleZijlstra JelleZijlstra self-assigned this Dec 25, 2022
JelleZijlstra added a commit to JelleZijlstra/black that referenced this issue Dec 25, 2022
@JelleZijlstra
Copy link
Collaborator Author

Some similar crashes that my PR doesn't solve:

% black --preview -c '''
async def f():
    with (x := await a, y := await b): pass
'''

async def f():
    with (x := await a, y := await b): pass
error: cannot format <string>: Cannot parse: 2:11:     with x := await a, y := await b:
% black --preview -c 'for (x := 3, y := 4) in y: pass'       
for (x := 3, y := 4) in y: pass
error: cannot format <string>: Cannot parse: 1:6: for x := 3, y := 4 in y:

@JelleZijlstra
Copy link
Collaborator Author

The first crash in the above comment is actually solved. The second appears to be invalid syntax on 3.11 so not worth spending more time on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. F: parentheses Too many parentheses, not enough parentheses, and so on. T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant