-
Notifications
You must be signed in to change notification settings - Fork 275
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
Invalid base class on Protocol (typing_extensions) #296
Comments
Thanks for the report! I think there are two things going on here:
|
I isolated my Protocol subclasses out to a project specific This is quite surprising, because it almost works (project level analysis faults, but calling pytype on modules that use the Protocol definitions will work as long as you keep pytype away from the actual files that define the Protocols) Example:
|
The I've mailed out fixes for all of these issues; they'll be exported to GitHub sometime today and should be in this Friday's release assuming nothing breaks. |
In reality, Protocol is defined in typing_extensions. It's hard for us to move our definition from typing to typing_extensions because typing can't depend on any libraries except builtins, so instead import the class. Partially addresses #296. PiperOrigin-RevId: 244037223
Supports custom protocols as long as they are defined in a different module from where they are used. Partially addresses #296. PiperOrigin-RevId: 244043001
Partially addresses #296. PiperOrigin-RevId: 244051213
The following minimal program validates with
pytype
andmypy
The following test program validates with MyPy but faults on pytype with the following messages:
Expected result:
pytype
correctly validatesProtocol
-derived structural subtyping.The text was updated successfully, but these errors were encountered: