Skip to content

Preview crashes on await (yield) #3532

Closed
@jakkdl

Description

@jakkdl

Describe the bug
black --preview crashes on seeing await (yield)
This is certainly not good code or anything, but is code we have in one of our test files in flake8-trio. Non-preview black has no issues with it.

To Reproduce

For example, take this code:

async def foo():
    await (yield)

And run it with these arguments:

$ black --preview myfile.py 

The resulting error is:

error: cannot format myfile.py: blib2to3.pytree.Node object expected; got blib2to3.pytree.Leaf

Oh no! 💥 💔 💥
1 file failed to reformat.

Expected behavior

Not crashing

Environment

$ black --version
black, 22.12.0 (compiled: yes)
Python (CPython) 3.11.0
$ python --version
Python 3.11.0
$ uname -sro
Linux 6.1.1-arch1-1 GNU/Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C: crashBlack is crashingC: preview styleIssues with the preview and unstable style. Add the name of the responsible feature in the title.T: bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions