Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typing.Protocol in 3.11 needs to be backported #104

Closed
Gobot1234 opened this issue Dec 26, 2022 · 2 comments · Fixed by #142
Closed

typing.Protocol in 3.11 needs to be backported #104

Gobot1234 opened this issue Dec 26, 2022 · 2 comments · Fixed by #142

Comments

@Gobot1234
Copy link
Contributor

In [6]: @runtime_checkable
   ...: class BaseBadge(Protocol):
   ...:     def __init__(self) -> None: ...

In [7]: BaseBadge.__init__
Out[7]: <function typing._no_init_or_replace_init(self, *args, **kwargs)>

This behaviour is not consistent with python 3.11

>>> from typing import *
>>> @runtime_checkable
... class BaseBadge(Protocol):
...     def __init__(self) -> None: ...
... 
>>> BaseBadge.__init__
<function BaseBadge.__init__ at 0x104f249a0>

This may have made me slightly concerned I was loosing my sanity in a subclass today 😀

@JelleZijlstra
Copy link
Member

This is python/cpython#31628, PR welcome.

@chrisjsewell
Copy link

Heya, I would also note that there will hopefully be another change coming, I guess in 3.12, that would be great to have backported: python/cpython#102433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants