-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
T: bugSomething isn't workingSomething isn't working
Description
Describe the bug
PEP 614 relaxed the syntax for decorators in python 3.9. However, black doesn't (yet ?) have a py39
target, and doesn't support this syntax.
To Reproduce
- Take this very simple file
test.py
from dataclasses import dataclass
d = [dataclass]
@d[0]
class A:
attr: int
print(A)
- Run Black on it :
black test.py
- See error
error: cannot format test.py: Cannot parse: 5:2: @d[0]
Expected behavior Black should accept and format code that is valid for python 3.9 (python test.py
prints <class '__main__.A'>
as expected).
Environment (please complete the following information):
- Version: master (commit 811decd)
- OS and Python version: Linux, Python 3.9.0rc1
Does this bug also happen on master?
- Use the online formatter at https://black.now.sh/?version=master
This produce the above error - Or run Black on your machine:
- create a new virtualenv (make sure it's the same Python version);
- clone this repository;
- run
pip install -e .
; - make sure it's sane by running
python -m unittest
(this fails, see Test failures with Python 3.9.0b1 #1441 ) - run
black
like you did last time.
This also produce the above error
Additional context Python 3.9 is in pre-release stage, so I'm not sure if this is a bug report or a feature request - I can change to the latter. PEP 614 highlights the use-case of the syntax (with examples from PyQt5), the above file is a minimalist file to illustrate the issue
Metadata
Metadata
Assignees
Labels
T: bugSomething isn't workingSomething isn't working