GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Spec and conformance tests disagree on converting constructors into callable for classes with `__new__` and `__init__` · Issue #2158 · python/typing

Spec and conformance tests disagree on converting constructors into callable for classes with __new__ and __init__ #2158

New issue
Copy link
New issue
Copy link
Open
#2314
Open
Spec and conformance tests disagree on converting constructors into callable for classes with __new__ and __init__#2158
#2314
Copy link
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

@fangyi-zhou
fangyi-zhou
opened on Jan 24, 2026
Issue body actions

For classes with both __new__ and __init__, when converting the constructor into a Callable, the spec says that

https://github.com/python/typing/blame/20096eeba502b1bf955fcf62b389adbaa63fc61b/docs/spec/constructors.rst#L457

    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`

Activity

  1. fangyi-zhou
    added
    topic: documentationDocumentation-related issues and PRsDocumentation-related issues and PRs
    on Jan 24, 2026
  2. srittau
    added
    topic: typing specFor improving the typing specFor improving the typing spec
    topic: conformance testsIssues with the conformance test suiteIssues with the conformance test suite
    and removed
    topic: documentationDocumentation-related issues and PRsDocumentation-related issues and PRs
    on Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: conformance testsIssues with the conformance test suiteIssues with the conformance test suitetopic: typing specFor improving the typing specFor improving the typing spec

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.