Skip to content

Conversation

@Daraan
Copy link
Contributor

@Daraan Daraan commented Sep 26, 2024

Fixes: #471

This PR fixes that these two cases should only yield T and not the unpack variable itself:

print(_collect_type_vars([Unpack[Movie[T]]]))
# (typing_extensions.Unpack[typing_extensions.Movie[~T]], ~T)

print(_collect_type_vars([Unpack[Tuple[T]]]))
# (typing_extensions.Unpack[typing.Tuple[~T]], ~T)

@Daraan Daraan changed the title Collect type vars unpack _collect_type_vars should not collect Unpack objects itself Sep 26, 2024
@JelleZijlstra
Copy link
Member

This is looking good now, could you also add a changelog entry like Alex added on a few other PRs today?

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks!

@JelleZijlstra JelleZijlstra merged commit 7632716 into python:main Sep 26, 2024
20 checks passed
@Daraan
Copy link
Contributor Author

Daraan commented Sep 26, 2024

Thanks!

Thanks to you two as well!

@Daraan Daraan deleted the _collect_type_vars_unpack branch October 11, 2024 15:26
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.

Backport of "_collect_type_vars" behaves wrong if Unpack is used on generic non-TypeVarTuple types

3 participants