Spec and conformance tests disagree on converting constructors into callable for classes with `__new__` and `__init__`
Open
Nobody has claimed this yet.
topic: conformance tests
topic: typing spec
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 302
- Avg merge
- 23h
- Merged PRs (30d)
- 8
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the constructor behavior described in docs/spec/constructors.rst around the linked section with the case in conformance/tests/constructors_callable.py. Determine which callable type is intended for a class defining both new and init, then align the specification and conformance test and run the relevant constructor conformance checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100