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 mode crash with --fast and walrus in except clause #3420

Closed
JelleZijlstra opened this issue Dec 10, 2022 · 0 comments · Fixed by #3423
Closed

Preview mode crash with --fast and walrus in except clause #3420

JelleZijlstra opened this issue Dec 10, 2022 · 0 comments · Fixed by #3423
Labels
T: bug Something isn't working

Comments

@JelleZijlstra
Copy link
Collaborator

$ black --fast -c '''
try: pass
except (a := 1) as (b := why_does_this_exist): pass
'''
try:
    pass
except (a := 1) as (b := why_does_this_exist):
    pass
$ black --preview --fast -c '''
try: pass
except (a := 1) as (b := why_does_this_exist): pass
'''

try: pass
except (a := 1) as (b := why_does_this_exist): pass
error: cannot format <string>: Cannot parse: 3:9: except a := 1 as (b := why_does_this_exist):
$ black --version
black, 22.12.0 (compiled: yes)
Python (CPython) 3.9.14

Similar to #3419, found this in CI for #3418. This needs --fast because CPython actually rejects walrus here (good call), but the grammar allows it.

This one probably comes from #2939, cc @jpy-git again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant