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

Ellipsis not working in Callable annotation #79

Open
jolaf opened this issue Sep 5, 2019 · 1 comment
Open

Ellipsis not working in Callable annotation #79

jolaf opened this issue Sep 5, 2019 · 1 comment

Comments

@jolaf
Copy link

jolaf commented Sep 5, 2019

The following code:

from typing import Callable

from pytypes import TypeChecker

def n() -> str:
    return "OK"

def f() -> Callable[..., str]:
    return n

with TypeChecker():
    print(f()())

fails as follows:

$ python3 Test.py
/usr/local/lib/python3.6/dist-packages/pytypes-1.0b5.post23-py3.6.egg/pytypes/type_util.py:2534: UserWarning: the system profiling hook has changed unexpectedly
  warn('the system profiling hook has changed unexpectedly')
Traceback (most recent call last):
  File "Test.py", line 12, in <module>
    print(f()())
  File "Test.py", line 8, in f
    def f() -> Callable[..., str]:
TypeError: Callable[[arg, ...], result]: each arg must be a type. Got Ellipsis.
@r5r3
Copy link

r5r3 commented Jan 9, 2020

Ellipsis is also not supported for tuples. E.g., Tuple[int, ...]. It would be very nice to get that supported!

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

No branches or pull requests

2 participants