-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Enable PEP 692 Support #14697
Comments
Is all of 692 supported? According to https://peps.python.org/pep-0646/#unpacking-unbounded-tuple-types I think the following should work from typing_extensions import Unpack
x: tuple[str, Unpack[tuple[int, ...]]]
x = ("a", 1, 2, 3) But I currently get (on mypy 1.1.1 on python 3.10.9)
|
PEP 692 applies only to annotations on |
I feel like this could remove many stubtest allowlist lines in TypeShed (where kwargs are manually unpacked) when fully supported. |
Ooh, a little off-topic, but I'd be curious if you have any examples @Avasam! Stubtest actually already has some special-case logic to specifically allow kwargs to be manually unpacked in a stub if the runtime just has |
Now that you mention it... I'll double check and come back to you (other here or in typeshed PRs). That might be it. |
Fixes #12280 Fixes #14697 In this PR: * Enable `TypeVarTuple` and `Unpack` features. * Delete the old blanket `--enable-incomplete-features` flag that was deprecated a year ago. * Switch couple corner cases to `PreciseTupleTypes` feature. * Add the draft docs about the new feature. * Handle a previously unhandled case where variadic tuple appears in string formatting (discovered on mypy self-check, where `PreciseTupleTypes` is already enabled). --------- Co-authored-by: Jelle Zijlstra <[email protected]>
Feature
PEP 692 support currently works but is gated behind --enable-incomplete-feature=Unpack. I think that flag includes both kwargs unpacking and variadic generics unpacking. It would be nice to move out just kwargs unpacking and have it available by default. That would enable typeshed/easier library usage of it.
Related typeshed issue.
The text was updated successfully, but these errors were encountered: