10000 Invalid signature for type object when both __init__ and __new__ · Issue #1435 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
Invalid signature for type object when both __init__ and __new__ #1435
Closed
@JukkaL

Description

@JukkaL

Mypy complains about the program even though it's valid Python:

class A(object):
    def __init__(self, x):
        pass

class B(A):
    def __new__(cls):
        return 1

B() # Too few arguments for "B"

It seems that mypy uses __init__ and doesn't recognize that __new__ in a subclass should take precedence.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0