Skip to content

Regression: "Attributes without a default cannot follow attributes with one" despite dataclass_transform with kw_only_default=True #14629

@rbuffat

Description

@rbuffat

Since mypy 1.0 the following code results in the following type error:

import envee


@envee.environment
class Environment:
    one: int = 1
    two: int  # error: Attributes without a default cannot follow attributes with one  [misc]`


env = envee.read(Environment)

The environment decorator of the envee library ensures that a dataclass with kw_only is created (if supported by Python) and indicates this using dataclass_transform(kw_only_default=True).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions