This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author julianfortune
Recipients julianfortune
Date 2021-09-01.21:06:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630530371.11.0.748962218101.issue45081@roundup.psfhosted.org>
In-reply-to
Content
I believe [`bpo-44806: Fix __init__ in subclasses of protocols`](https://github.com/python/cpython/pull/27545) has caused a regression when using a Dataclass.

In Python `3.9.7`, a `dataclass` that inherits from a subclass of `typing.Protocol` (i.e., a user-defined protocol), does not have the correct `__init__`.

### Demonstration

```python
from dataclasses import dataclass
from typing import Protocol

class P(Protocol):
    pass

@dataclass
class B(P):
    value: str

print(B("test"))
```
In `3.9.7`:
```shell
Traceback (most recent call last):
  File "test.py", line 11, in <module>
    print(B("test"))
TypeError: B() takes no arguments
```
In `3.9.6`:
```shell
B(value='test')
```

### Affected Projects

- [dbt](https://github.com/dbt-labs/dbt/issues/3843)
History
Date User Action Args
2021-09-01 21:06:11julianfortunesetrecipients: + julianfortune
2021-09-01 21:06:11julianfortunesetmessageid: <1630530371.11.0.748962218101.issue45081@roundup.psfhosted.org>
2021-09-01 21:06:11julianfortunelinkissue45081 messages
2021-09-01 21:06:11julianfortunecreate