typing_extensions
typing_extensions copied to clipboard
Added support for Concatenate with Ellipsis
Fixes #110 for Python 3.9-3.10:
An Ellipsis cannot be used with Concatenate
as last parameter must be a ParamSpec
in Python 3.11 this is allowed, Python 3.10 does not support this.
Does not fix:
- #48 : Using Ellipsis as argument for Callable with a generic..
- <= 3.9: because of
typing.Callable
limitations - For 3.10 could go back to
typing_extentions._ConcatenateGenericAlias
but also tricky.
- <= 3.9: because of
- #110 for Python 3.8 as this is caused by
typing.Callable
as it does only accepts args that are types, i.e.Ellipsis
is not supported.
Changes:
- Changed
_concatenate_getitem
to reflect the Python3.11 typing module that allows the Ellipsis parameter. - For Python 3.10 uses
typing._ConcatenateGenericAlias
and an alternate_concatenate_getitem
- For <=Python 3.9 the
typing_extensions._ConcatenateGenericAlias
and_concatenate_getitem
like before - Added tests
Python Versions:
- 3.8 not fixable, ok but skipped tests.
- 3.9 ok
- 3.9.0 ok (locally)
- 3.10 ok
- 3.10.0 ok (locally)
- 3.11 ok - no backport. One new test for #48 that only runs on 3.11+
EDIT: Accounted for changes in Python. 3.9.2 and ~3.10.2, Tests for 3.*.0 should work now.