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

typing_extensions crash on Python 3.5.0 - 3.5.2 if used together with collections.abc #501

Closed
ilevkivskyi opened this issue Nov 24, 2017 · 0 comments · Fixed by #503
Closed
Assignees

Comments

@ilevkivskyi
Copy link
Member

Originally reported in dropbox/pyannotate#36

A simple repro

import typing_extensions
import collections.abc
isinstance(1, collections.abc.Mapping)

leads to a recursion error like this: https://travis-ci.org/ilevkivskyi/typehinting/jobs/306766341

@ilevkivskyi ilevkivskyi self-assigned this Nov 24, 2017
ilevkivskyi added a commit that referenced this issue Dec 1, 2017
Fixes #501

The idea is straightforward: special classes in typing_extensions
that have __extra__ should use a metaclass that fixes the problem in
GenericMeta.__subclasscheck__ on older versions of typing.

Note that overriding __subclasscheck__ tries to mimic the behaviour
in the new versions of typing. (I can't just use super().__subclasscheck__
on unaffected versions, since this changes call stack depth and therefore
breaks a sys._getframe hack on some other versions of typing.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant