Skip to content

Conversation

@ilevkivskyi
Copy link
Member

Fixes #297

This allows to use isinstance() with classes that inherit from protocols in typing.py such as SupportsInt etc.

@gvanrossum I was thinking about how protocols should work (including runtime), and now I think that the "quick-fix" that you proposed is actually the right fix for this issue. (Main motivation is that a class that inherits from a protocol should not be considered a protocol itself, unless it lists Protocol in bases.)

Please, take a look.

@gvanrossum gvanrossum merged commit 1881ffd into python:master Nov 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isinstance + class indirectly deriving from SupportsInt results in "TypeError: Protocols cannot be used with isinstance()"

3 participants