python / typing_extensions

Backported and experimental type hints for Python
Other
446 stars 110 forks source link

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

Closed Daraan closed 1 month ago

Daraan commented 1 month ago

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.


Daraan commented 1 month ago

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