Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rbuffat opened this issue Feb 7, 2023 · 1 comment
Labels
bug mypy got something wrong topic-dataclass-transform PEP 681

Comments

@rbuffat
Copy link

rbuffat commented Feb 7, 2023

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).

@rbuffat rbuffat added the bug mypy got something wrong label Feb 7, 2023
@JelleZijlstra
Copy link
Member

cc @wesleywright for dataclass-transform. I added topic-dataclass-transform PEP 681 to classify similar issues in the future. I believe #14580 will fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-dataclass-transform PEP 681
Projects
None yet
Development

No branches or pull requests

3 participants