Visitar URL original
Fix isinstance() with generic protocol subclasses after subscripting by ilevkivskyi · Pull Request #669 · python/typing · GitHub
The Wayback Machine - https://web.archive.org/web/20201019095605/https://github.com/python/typing/pull/669
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

Fix isinstance() with generic protocol subclasses after subscripting #669

Merged
merged 2 commits into from Aug 22, 2019

Conversation

@ilevkivskyi
Copy link
Collaborator

@ilevkivskyi ilevkivskyi commented Aug 22, 2019

Fixes #656

The problem is if a generic class inherits from a protocol, then GenericMeta.__subclasscheck__()
gets overridden with _ProtocolMeta.__subclasscheck__() that calls the former via super(), thus causing an extra frame.

@ilevkivskyi ilevkivskyi merged commit a522554 into python:master Aug 22, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ilevkivskyi ilevkivskyi deleted the ilevkivskyi:fix-proto-2 branch Aug 22, 2019
@gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Aug 22, 2019

@ilevkivskyi
Copy link
Collaborator Author

@ilevkivskyi ilevkivskyi commented Aug 22, 2019

Be sure to also merge this upstream in the cpython repo.

The bug is Python 2 specific, but I wanted to add tests to python/cpython to prevent regressions.

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

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.