Skip to content

Fix mro invoking #10137 #10138

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

Merged
merged 2 commits into from
Feb 26, 2021
Merged

Conversation

gen-xu
Copy link
Contributor

@gen-xu gen-xu commented Feb 26, 2021

Description

Fixes #10137
Changed obj.mro() to type.mro(obj) so it properly invokes the mro of type when obj is type

Test Plan

After this change, stubgen can properly generate pyi files for cython modules or native modules that include types inheriting the builtin type. Any package include such definition of class would be suitable for testing this.
Added a unittest for generate_c_type_stub as well.

@gen-xu gen-xu changed the title Fix mro invoking Fix mro invoking #10137 Feb 26, 2021
@JelleZijlstra
Copy link
Member

Thanks! Would it be possible to write a unit test?

@gen-xu gen-xu force-pushed the gen-xu/type.mro-fix branch from 193741a to 7b990b6 Compare February 26, 2021 22:19
@gen-xu
Copy link
Contributor Author

gen-xu commented Feb 26, 2021

Thanks! Would it be possible to write a unit test?

Added unit test for generate_c_type_stub

@JelleZijlstra JelleZijlstra merged commit 72ac2ce into python:master Feb 26, 2021
sthagen added a commit to sthagen/python-mypy that referenced this pull request Feb 27, 2021
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.

stubgenc.py throw TypeError: unbound method type.mro() needs an argument
2 participants