Skip to content

_UnpackAlias __class__ attribute #538

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

Closed
Viicos opened this issue Mar 12, 2025 · 2 comments
Closed

_UnpackAlias __class__ attribute #538

Viicos opened this issue Mar 12, 2025 · 2 comments

Comments

@Viicos
Copy link
Contributor

Viicos commented Mar 12, 2025

Is there a reason to have the __class__ attribute of the _UnpackAlias class set to typing.TypeVar?

class _UnpackAlias(typing._GenericAlias, _root=True):
__class__ = typing.TypeVar

It doesn't seem to be present on typing.

@Daraan
Copy link
Contributor

Daraan commented Mar 12, 2025

This is a needed for <3.11 when e.g. using class Bar(Generic[typing_extensions.Unpack[Ts]]) to be compatible with <3.11 typing isinstance(typing_extensions.Unpack[...], TypeVar) check during Generic.__class_getitem__.

I think for 3.11 we could safely remove the changed attribute from the backport.

@Viicos
Copy link
Contributor Author

Viicos commented Mar 13, 2025

Thanks, that clarifies it!

@Viicos Viicos closed this as completed Mar 13, 2025
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

No branches or pull requests

2 participants