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

Add support for assert_type #12584

Merged
merged 3 commits into from
Apr 15, 2022
Merged

Conversation

JelleZijlstra
Copy link
Member

See python/cpython#30843.

The implementation mostly follows that of cast(). It relies on
mypy.sametypes.is_same_type().

See python/cpython#30843.

The implementation mostly follows that of cast(). It relies on
`mypy.sametypes.is_same_type()`.
@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member Author

For comparison, the implementation in pyright is in microsoft/pyright@4edb1b4 (6 files, 96 lines) and the one in pyanalyze is in quora/pyanalyze@b11f15a (4 files, 80 lines).

@github-actions

This comment has been minimized.

Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid and straightforward

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 8757747 into python:master Apr 15, 2022
@JelleZijlstra JelleZijlstra deleted the asserttype branch April 15, 2022 03:53
JukkaL pushed a commit that referenced this pull request Apr 20, 2022
See python/cpython#30843.

The implementation mostly follows that of cast(). It relies on
`mypy.sametypes.is_same_type()`.
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.

3 participants