10000 Implement TypeGuard (PEP 649) by JelleZijlstra · Pull Request #803 · python/typing · GitHub
[go: up one dir, main page]

Skip to content

Implement TypeGuard (PEP 649) #803

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 9 commits into from
May 1, 2021
Merged

Conversation

JelleZijlstra
Copy link
Member
@JelleZijlstra JelleZijlstra commented Apr 29, 2021

This should be the last missing piece for a 3.10-compatible release.

The implementation was mostly inspired by that of Final, with an additional special case for 3.9.

@JelleZijlstra
Copy link
Member Author

Whew I finally managed to defeat Python 3.5.2. @Fidget-Spinner would you mind reviewing this PR?

@Fidget-Spinner
Copy link
Member
Fidget-Spinner commented Apr 29, 2021

Whew I finally managed to defeat Python 3.5.2.

Indeed, no f-strings are a pain I thought I'd never experience again :(.

@Fidget-Spinner would you mind reviewing this PR?

Sure, I'll try to review it by this weekend (caught up with some other stuff right now).

Copy link
Member
@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

LGTM. I can see the parallels with Final (I also learnt a lot about typing's older incarnations - e.g. didn't know _eval_type was strictly compulsory in older versions).

Supporting so many versions of typing is tricky. Thanks for handling the backport!

@JelleZijlstra JelleZijlstra merged commit c33fe16 into python:master May 1, 2021
@JelleZijlstra JelleZijlstra deleted the typeguard branch May 1, 2021 00:40
@JelleZijlstra
Copy link
Member Author

Thanks for the review! Now it's time to prepare a release.

zundertj added a commit to zundertj/polars that referenced this pull request Dec 27, 2021
Closes pola-rs#2185.

Im not 100% sure this has not been in before v4, i.e. the PR (python/typing#803) was merged May 1, and the same day 3.10.0 of the package was released. However, I dont think it hurts to push to v4?
ritchie46 pushed a commit to pola-rs/polars that referenced this pull request Dec 28, 2021
Closes #2185.

Im not 100% sure this has not been in before v4, i.e. the PR (python/typing#803) was merged May 1, and the same day 3.10.0 of the package was released. However, I dont think it hurts to push to v4?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0