Skip to content

Conversation

@erictraut
Copy link
Collaborator

Removed mandatory enforcement of "default value type of list, dict, or set" for dataclass fields in the dataclasses_inheritance test. This error is now optional for type checkers.

The typing spec doesn't mandate such a rule. This particular test in the conformance suite was based on a part of PEP 557 that was not officially incorporated into the typing spec, so it's questionable whether it belongs in the conformance suite in the first place. None of the major type checkers currently implement this check. I tried implementing it in pyright, and it creates a bunch of false positives for libraries like pydantic and attrs that use dataclass_transform and don't have this same limitation. See this thread for more details.

Also fixed the conformance summary for pyright in the aliases_typealiastype test, which was out of date and didn't reflect the fact that pyright now passes this test.

…r set" for dataclass fields in the `dataclasses_inheritance` test. This error is now optional for type checkers.

Also fixed the conformance summary for pyright in the `aliases_typealiastype` test, which was out of date and didn't reflect the fact that pyright now passes this test.
@erictraut erictraut merged commit d25bc6c into python:main Jun 17, 2025
4 checks passed
@erictraut erictraut deleted the dataclassDefaults branch June 17, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants