Skip to content

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

Closed
Daraan wants to merge 2 commits into
python:mainfrom
Daraan:concatenate/ellipsis-3.10
Closed

Daraan wants to merge 2 commits into
python:mainfrom
Daraan:concatenate/ellipsis-3.10

Conversation

@Daraan

@Daraan Daraan commented Oct 3, 2024 •

Copy link
Copy Markdown
Contributor

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 Oct 3, 2024
@Daraan

Daraan commented Oct 3, 2024 •

Copy link
Copy Markdown
Contributor Author

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

1 participant