dataclasses_match_args
error
Access to __match_args__ on a dataclass with match_args=False
When @dataclass(match_args=False) is specified, Python does **not** generate the __match_args__ class variable. Accessing ClassName.__match_args__ on such a class is an AttributeError at runtime and a static type error.
from dataclasses import dataclass
@dataclass(match_args=False)
class DC4:
x: int
DC4.__match_args__ # E: attribute not generated
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
dataclasses_match_args down per-file or per-path from your editor or
pyproject.toml, or fix the code
so it type-checks. See the Type System rules and
the complete diagnostic reference.
Canonical URL: https://www.basilisk-python.dev/errors/dataclasses_match_args