Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-46644: Remove callable() requirement from typing._type_check#31151

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

GBeauregard
Copy link
Contributor

@GBeauregardGBeauregard commentedFeb 5, 2022
edited by bedevere-bot
Loading

We remove tests that check for int literals. A check that a type isn't a tuple literal was added to cover cases likeFinal[int, str]. This codepath wasn't covered forTypeGuard so I added a test for it. Note we already disallow tuple types since things like Union[typeform]->typeform, but Union[typeform, typeform] -> Union[typeform, typeform].

https://bugs.python.org/issue46644

@GBeauregardGBeauregard marked this pull request as ready for reviewFebruary 5, 2022 22:10
@GBeauregardGBeauregard changed the titlebpo-46644: Remove type check callablebpo-46644: Remove callable() requirement from typing._type_checkFeb 5, 2022
@gvanrossum
Copy link
Member

Since there is still discussion going on in bpo this shouldnot yet be merged.

Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

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

I still think we should move forward with this change and close the alternative#31159 (cc@gvanrossum@Fidget-Spinner@serhiy-storchaka). Being permissive in the typing.py runtime helps make innovation in the type system possible.

PEP 612 and 646 were difficult to implement in typing-extensions because of overly strict checks in typing.py (e.g.https://github.com/python/typing/blob/95c9c2bab2034f0359e8457360d93a288a65e55d/typing_extensions/src/typing_extensions.py#L1860,https://github.com/python/typing/blob/95c9c2bab2034f0359e8457360d93a288a65e55d/typing_extensions/src/typing_extensions.py#L1900). To make future PEPs easier to implement, I want to generally keep runtime checks in typing.py at a minimum. This PR removes a check that has been particularly problematic.

AlexWaygood reacted with thumbs up emoji
Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

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

Yes, that’s fair. Godspeed!

@JelleZijlstraJelleZijlstra self-assigned thisMar 10, 2022
Copy link
Member

@Fidget-SpinnerFidget-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. Feel free to ignore my comment below.

@@ -0,0 +1 @@
No longer require valid typeforms to be callable. This allows :data:`typing.Annotated` to wrap :data:`typing.ParamSpecArgs` and :data:`dataclasses.InitVar`. Patch by Gregory Beauregard.

Choose a reason for hiding this comment

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

Each line should be under 80 chars. However since this is usually merged into the next release's changelog anyways I'm not sure if it matters.

Choose a reason for hiding this comment

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

Yes, I think blurb takes care of that when it generates the full changelog.

@JelleZijlstraJelleZijlstra merged commit870b22b intopython:mainMar 12, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JelleZijlstraJelleZijlstraJelleZijlstra approved these changes

@gvanrossumgvanrossumgvanrossum approved these changes

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

Assignees

@JelleZijlstraJelleZijlstra

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@GBeauregard@gvanrossum@JelleZijlstra@Fidget-Spinner@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp