-
Notifications
You must be signed in to change notification settings - Fork 285
Open
Labels
topic: conformance testsIssues with the conformance test suiteIssues with the conformance test suitetopic: typing specFor improving the typing specFor improving the typing spec
Description
For classes with both __new__ and __init__, when converting the constructor into a Callable, the spec says that
class B:
""" __new__ and __init__ """
def __new__(cls, *args, **kwargs) -> Self:
...
def __init__(self, x: int) -> None:
...
reveal_type(accepts_callable(B)) # ``def (*args, **kwargs) -> B | def (x: int) -> B``The conformance test says that
typing/conformance/tests/constructors_callable.py
Lines 54 to 64 in 20096ee
| class Class3: | |
| """__new__ and __init__""" | |
| def __new__(cls, *args, **kwargs) -> Self: | |
| raise NotImplementedError | |
| def __init__(self, x: int) -> None: ... | |
| r3 = accepts_callable(Class3) | |
| reveal_type(r3) # `def (x: int) -> Class3` |
Metadata
Metadata
Assignees
Labels
topic: conformance testsIssues with the conformance test suiteIssues with the conformance test suitetopic: typing specFor improving the typing specFor improving the typing spec