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

Fix subscription of Unpack causing nested Unpacks to not be resolved correctly #480

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Oct 4, 2024

The current Unpack alias backport had an issue that it did not resolve correctly during substition.
This PR fixes that the following should hold, or rather that the subscription does not raise a TypeError.

from typing_extensions import TypeVarTuple, Unpack
Ts = TypeVarTuple("Ts")
assert Unpack[Ts][str] is str

This fixes #474 and was solved by simply adding the Python 3.12+ code to the alias classes.

Sitenote: This is only slightly related to #103, the code sample there also did not work in 3.11 after the backport was used. However, the error is not related and still persists for <=3.10.

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.

Nested use of Unpack in alias from TypeAliasType causes TypeError on Python 3.11
1 participant