Skip to content

Wrong unsoundness? #1330

Closed
Closed

Description

@AntoineD

The following reproducer code returns the __init__ method of a class:

from typing import Any
def f(cls: type) -> Any:
    return cls.__init__

but mypy considers that the __init__method was accessed from an instance:
main.py:4: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass [misc]

Where is the problem?

Activity

  1. locked and limited conversation to collaborators on Jan 7, 2023
  2. converted this issue into a discussion #1331 on Jan 7, 2023
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: otherOther topics not covered

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions