-
-
Notifications
You must be signed in to change notification settings - Fork 118
Concatenate
implementation generates runtime exception if parameterized by ...
#48
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
Comments
This seems like a bug in Python's typing module itself. # In 3.9
typing.Callable[T, int][...]
TypeError: Parameters to generic types must be types. Got Ellipsis. The problem is that I don't think we can fix this from |
Also, we're sadly past the stage for bugfixes in 3.9. I suggest that we add this to the known limitations in the README and (unfortunately) close as can't fix. |
This is now documented as a limitation at https://typing-extensions.readthedocs.io/en/latest/#Concatenate. If there is a reasonable way to fix it, I'd accept a PR. |
I am currently looking at this again and the statement that "It runs fine on Python 3.10 if using typing.Concatenate" confused be a bit.
|
As a summary: #479 covered this Issue only for 3.10, or rather 3.10.3+. For 3.8 & 3.9 I see no other way around monkey patching - params = tuple(_type_check(p, msg) for p in params)
+ params = tuple(typing._type_check(p, msg) if p is not ... else ...
+ for p in params) |
The following code should work without a runtime exception.
It runs fine on Python 3.10 if using
typing.Concatenate
but fails on Python 3.9 if usingtyping_extensions.Concatenate
. The runtime exception is:The text was updated successfully, but these errors were encountered: