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

Synthesized __dataclass_fields__ should be a ClassVar #4157

Closed
erictraut opened this issue Nov 7, 2022 · 1 comment
Closed

Synthesized __dataclass_fields__ should be a ClassVar #4157

erictraut opened this issue Nov 7, 2022 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@erictraut
Copy link
Collaborator

Pyright synthesizes a field called __dataclass_fields__ for dataclass and dataclass-like (PEP 681) classes.

It currently declares this synthesized field as a normal class-level variable (i.e. a class variable that can be overridden by an instance variable). It should probably be a ClassVar. Mypy models it as such.

See mypy issue python/mypy#14029 for more context.

@erictraut erictraut added bug Something isn't working addressed in next version Issue is fixed and will appear in next published version labels Nov 7, 2022
erictraut pushed a commit that referenced this issue Nov 7, 2022
…to be a `ClassVar` so it cannot be overridden by an instance variable. This addresses #4157.
@erictraut
Copy link
Collaborator Author

This is included in pyright 1.1.279, which I just published. It will also be included in a future version of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant