-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly
Description
Bug Report
When Protocol is not marked with runtime_checkable decorator, isinstance(instance, runtime_checkable(ProtocolClass)) gives incorrect error.
This could be pretty useful when you don't want to mark protocol as runtime_checkable for the execution while in tests you would like to check protocol compliance
To Reproduce
playground link - https://mypy-play.net/?mypy=master&python=3.12&gist=54f484ed23e70f7d771f08bf839f8e4e
Expected Behavior
Success: no issues found in 1 source file
Actual Behavior
main.py:20: error: Only @runtime_checkable protocols can be used with instance and class checks [misc]
Found 1 error in 1 file (checked 1 source file)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-runtime-semanticsmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly