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

Allow subscription of Callable[Concatenate[P], Any] with ellipsis in Python 3.10 #478

Closed
wants to merge 2 commits into from

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Oct 3, 2024

Fixes #48 for python 3.10.3+

The first versions 3.10.0 - 3.10.2 did not enforce restrictions on the last parameter of _ConcatenateGenericAlias, 3.10.3-3.10.* only supports ParamSpec, i.e. no Ellipsis, hence #48 also holds for these versions.

This PR monkey patches the copy_with method of typing._ConcatenateGenericAlias with the Python 3.11 equivalent that accepts an ellipsis variant.


  • This does not solve 110 , which requires an earlier check during Concatenate
  • A backport to 3.8, 3.9 would need a monkey patch of typing._type_check

@Daraan Daraan changed the title Allow Allow subscription of Callable[Concatenate[P], Any] with ellipsis in Python 3.10 Oct 3, 2024
@Daraan
Copy link
Contributor Author

Daraan commented Oct 3, 2024

Welp it fails the "C[...]" cases in test_typing.py this tries to address 😥 This goes back to ~ python/cpython#27518. I guess its not acceptable then.

@Daraan Daraan closed this Oct 3, 2024
@Daraan Daraan deleted the concatenate/ellipsis-3.10 branch October 3, 2024 18:58
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.

Concatenate implementation generates runtime exception if parameterized by ...
1 participant