fromdataclassesimportdataclass, InitVar, KW_ONLY@dataclassclassA:
_: KW_ONLYx: InitVar[int]
def__post_init__(self, x: int) ->None:
pass@dataclassclassC(A):
y: InitVar[str]
def__post_init__(self, x: int, y: str) ->None: # Correct order.super().__post_init__(x)
gives
a.py:19: error: Argument 2 of "__post_init__" is incompatible with supertype "dataclass"; supertype defines the argument type as "str" [override]
def __post_init__(self, x: int, y: str) -> None:
^~~~~~
a.py:19: error: Argument 3 of "__post_init__" is incompatible with supertype "dataclass"; supertype defines the argument type as "int" [override]
def __post_init__(self, x: int, y: str) -> None:
gives