[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-12 Thread Ian Good
Ian Good added the comment: Julian, That is certainly a workaround, however the behavior you are describing is inconsistent with PEP-544 in both word and intention. From the PEP: > To explicitly declare that a certain class implements a given protocol, it > can be used as a regular base

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-12 Thread Julian Fortune
Julian Fortune added the comment: Ian, `MyProtocol` does not provide an `__init__()`, and thus ``` super().__init__() ``` is calling the `__init__()` from `Protocol`. This results in the `TypeError`. Simply remove `super().__init__()` to resolve your issue. This behavior was changed in

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-11 Thread Ian Good
Ian Good added the comment: I believe this was a deeper issue that affected all classes inheriting Protocol, causing a TypeError on even the most basic case (see attached): Traceback (most recent call last): File "/.../test.py", line 14, in MyClass() File "/.../test.py", line 11, in

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-03 Thread Łukasz Langa
Change by Łukasz Langa : -- versions: +Python 3.10, Python 3.11 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-03 Thread miss-islington
miss-islington added the comment: New changeset 79e9f5a58427c73dc546cb571819d50defe2e14f by Miss Islington (bot) in branch '3.10': bpo-45081: Fix __init__ method generation when inheriting from Protocol (GH-28121)

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Julian Fortune
Change by Julian Fortune : -- stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 98eb40828af97760badfa7b8ff84bd4f7a079839 by Miss Islington (bot) in branch '3.9': bpo-45081: Fix __init__ method generation when inheriting from Protocol (GH-28121) (GH-28132)

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 8.0 -> 9.0 pull_requests: +26569 pull_request: https://github.com/python/cpython/pull/28131 ___ Python tracker

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread miss-islington
Change by miss-islington : -- pull_requests: +26570 pull_request: https://github.com/python/cpython/pull/28132 ___ Python tracker ___

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset 0635e201beaf52373f776ff32702795e38f43ae3 by Yurii Karabas in branch 'main': bpo-45081: Fix __init__ method generation when inheriting from Protocol (GH-28121) https://github.com/python/cpython/commit/0635e201beaf52373f776ff32702795e38f43ae3

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj, lukasz.langa, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Yurii Karabas
Change by Yurii Karabas <1998uri...@gmail.com>: -- keywords: +patch nosy: +uriyyo nosy_count: 4.0 -> 5.0 pull_requests: +26562 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28121 ___ Python tracker

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Shrikant Narasimhan
Change by Shrikant Narasimhan : -- nosy: +shrik ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-01 Thread Edgar Ramírez
Change by Edgar Ramírez : -- nosy: +edgarrmondragon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-01 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-01 Thread Julian Fortune
New submission from Julian Fortune : 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