Skip to content

(🐞) false negative with dataclass "non-default argument follows default argument" #12137

@KotlinIsland

Description

@KotlinIsland
from dataclasses import dataclass

@dataclass
class A:
    a: int = 0

@dataclass
class B(A):
    a: int
    b: str

Mypy shows no error but this fails at runtime with TypeError: non-default argument 'b' follows default argument

playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions