Describe the bug
Blackd is inconsistent with black in regards to formatting invalid f-strings. While black returns a consistent error code of '123' for , and f"{}", blackd returns an expected 400 for the former, but a surprising 500 for the later.
To Reproduce
👉 curl -XPOST "localhost:9090" -d "," -i
400: bad request, take it away
Cannot parse: 1:0: ,
👉 curl -XPOST "localhost:9090" -d 'f"{}"' -i
500: internal server error
cannot use --safe with this file; failed to parse source file AST: f-string: empty expression not allowed (<unknown>, line 1)
This could be caused by running Black with an older Python version that does not support new syntax used in your source file.
Environment
- Black's version: 23.1.0
- OS and Python version: windows / python 3.11.2
Describe the bug
Blackd is inconsistent with black in regards to formatting invalid f-strings. While black returns a consistent error code of '123' for
,andf"{}", blackd returns an expected 400 for the former, but a surprising 500 for the later.To Reproduce
Environment