Closed
Description
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