-
-
Notifications
You must be signed in to change notification settings - Fork 118
Third-party tests failed on Fri Jun 02 2023 #213
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
Comments
I can reproduce the failures locally in a clean virtual environment on 3.7. The specific test that's failing is I've bisected the failure to this Haven't yet done any investigation to figure out whether this is a |
Temporary workaround for python#213 until the tests pass on 3.7 again
#214 skips |
The reason why So Footnotes
|
Cc. @Tinche for I'm not too familiar with the architecture of |
Thanks @AlexWaygood , I'll take a look! |
Here's a helper function from cattrs: def is_protocol(type: Any) -> bool:
return issubclass(type, Protocol) and getattr(type, "_is_protocol", False) On The failing test is trying to match on class Proto(Protocol):
a: int but that should also now be marked |
Thanks @Tinche, that helps me diagnose the problem! And I think it is a regression in On Python 3.11, you can do this: >>> import typing
>>> issubclass(object, typing.Protocol)
False But on Python 3.12, you can't anymore: >>> import typing
>>> issubclass(object, typing.Protocol)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\alexw\coding\cpython\Lib\typing.py", line 1797, in __subclasscheck__
raise TypeError(
TypeError: Instance and class checks can only be used with @runtime_checkable protocols The new behaviour doesn't make much sense to me. That So I think this needs to be fixed in CPython and |
I think that's unrelated to my test though. Here's a minimal repro: from typing_extensions import Protocol
class Proto(Protocol):
a: int
def is_protocol(type) -> bool:
return issubclass(type, Protocol) and getattr(type, "_is_protocol", False)
is_protocol(Proto) (so I am calling it against a subclass of protocol.) On 4.6.3 this raises, on 4.6.2 it returns True. That's the expected behavior now, since it's not runtime_checkable? |
It raises because of your |
Ah right I get it, |
Runs listed here: https://github.com/python/typing_extensions/actions/workflows/third_party.yml
The text was updated successfully, but these errors were encountered: