-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
C: crashBlack is crashingBlack is crashingF: parenthesesToo many parentheses, not enough parentheses, and so on.Too many parentheses, not enough parentheses, and so on.T: bugSomething isn't workingSomething isn't working
Description
Describe the bug
black converts await (a**b) into await a ** b (if run with --fast)
To Reproduce
async def name_5():
await (name_1 ** name_4)And run it with these arguments:
$ black file.pyThe resulting error is:
cannot format file.py: INTERNAL ERROR: ...
Expected behavior
black should preserve the braces and be able to format the file
Environment
python -m black, 23.3.1.dev10+geb32729 (compiled: no)
Python (CPython) 3.11.3
Additional context
error log:
--- src
+++ dst
@@ -14,34 +14,34 @@
None, # NoneType
) # /arguments
body=
Expr(
value=
- Await(
- value=
- BinOp(
- left=
+ BinOp(
+ left=
+ Await(
+ value=
Name(
ctx=
Load(
) # /Load
id=
'name_1', # str
) # /Name
- op=
- Pow(
- ) # /Pow
- right=
- Name(
- ctx=
- Load(
- ) # /Load
- id=
- 'name_4', # str
- ) # /Name
- ) # /BinOp
- ) # /Await
+ ) # /Await
+ op=
+ Pow(
+ ) # /Pow
+ right=
+ Name(
+ ctx=
+ Load(
+ ) # /Load
+ id=
+ 'name_4', # str
+ ) # /Name
+ ) # /BinOp
) # /Expr
decorator_list=
name=
'name_5', # str
returns=
For context:
I currently write a generator wich generates random python code. This is still work in progress, but finding bugs in black shows me that I am on the right track.
I will provide a script similar to scripts/fuzz.py as soon as it is ready.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C: crashBlack is crashingBlack is crashingF: parenthesesToo many parentheses, not enough parentheses, and so on.Too many parentheses, not enough parentheses, and so on.T: bugSomething isn't workingSomething isn't working