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

Include __extra__ base in generics MRO #287

Merged
merged 2 commits into from
Sep 29, 2016
Merged

Conversation

ilevkivskyi
Copy link
Member

Fixes #203
@gvanrossum
This is a simple-minded fix. Basically, I just copied some parts from #207 + small tweaks + backport to Python 2. Note that this makes classes inherited from typing.Mapping etc. real ABCs, i.e. they could not be instantiated without implementing all the abstract methods (in this sense typing.X and collections.abc.X are identical).

Please take a look.

@gvanrossum
Copy link
Member

Thanks! I will not pretend I understand everything that's going on, but we have enough tests that I sort of believe it's better, not worse.

Have you thought more about Union[Any, x]?

@bintoro
Copy link
Contributor

bintoro commented Sep 29, 2016

@ilevkivskyi #207 added a few more tests that I believe are important. Did you omit them intentionally?

@ilevkivskyi
Copy link
Member Author

@gvanrossum I will make PRs about Union[Any, x] later today, we could discuss details in those PRs.

@bintoro Could you please point more precisely to the tests (line numbers/names)? Most probably I just overlooked them (I added some tests in my previous PR).

@bintoro
Copy link
Contributor

bintoro commented Sep 29, 2016

@ilevkivskyi Have a look from this line on. Not all of them are applicable anymore, but most are.

The code interacting with the ABC machinery is somewhat intricate (and could actually use a thorough review), so it's important to test it works with things like register() and custom subclasshooks.

@ilevkivskyi
Copy link
Member Author

@bintoro Thanks! I will make a PR with these tests later, right after I finish with Union[X, Any].

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 this pull request may close these issues.

typing.MutableMapping not a drop-in replacement for collections.abc.MutableMapping
3 participants