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

Concatenate to support Ellipsis argument #481

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Oct 5, 2024

Fixes #110.

This PR adds support for Ellipsis in Concatenate for the Python 3.8-3.10 backports.

Does not fix:

Changes:
- Changed _concatenate_getitem to reflect the Python3.11 typing module that allows the Ellipsis parameter.
- For Python 3.10 uses typing._ConcatenateGenericAlias and _concatenate_getitem
- For <=Python 3.9 the typing_extensions._ConcatenateGenericAlias and _concatenate_getitem like before
- For <3.9.2 uses a Dummy class that is temporarily swapped with an Ellipsis input
- added tests and updated tests

@Daraan
Copy link
Contributor Author

Daraan commented Oct 5, 2024

I am sorry I had to recreate #442.

Latest change since then:

-        if not TYPING_3_11_0:
-            with self.assertRaisesRegex(
-                TypeError,
-                'each arg must be a type',
-           ):
-              Concatenate[1, P]
# different location
+    def test_invalid_use(self):
+       # Assure that `_type_check` is called.
+        P = ParamSpec('P')
+        with self.assertRaisesRegex(
+            TypeError,
+            "each arg must be a type",
+        ):
+            Concatenate[(str,), P]

@Daraan Daraan changed the title Concatenate/ellipsis support 110 Concatenate to support Ellipsis argument Oct 8, 2024
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 allowing passing an ellipsis as the last argument of Concatenate to 3.10
1 participant