Conformance: remove non-data-descriptor tests in dataclasses_descriptors.py#2319
Closed
ashishpatel26 wants to merge 1 commit into
Closed
Conversation
…ors.py The Desc2/DC2 test case asserted that dataclass fields typed with a non-data descriptor (a class implementing only __get__, no __set__) resolve through the descriptor protocol. That assertion doesn't match runtime behavior: such fields are stored as plain instance attributes, so the descriptor's __get__ never runs on instance access. The correct behavior for non-data descriptors in dataclasses is underspecified, so remove the incorrect assertions until the spec covers this case. The Desc1 (data descriptor) test, which is correct and confirmed against runtime, is unaffected. Fixes python#2259
Collaborator
|
I'm closing this, since you already opened a pull request for the same issue: #2299. Please next time check at least the issue you're trying to fix for your own pull requests and other pull requests. Also please check for others who have tried to solve the issue. This is just wasting maintainer time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Desc2/DC2test indataclasses_descriptors.pyasserted type-checker behavior for non-data descriptors (objects with__get__but no__set__) used as dataclass fields.__get__never actually fires on instance access.Desc1(data descriptor) case, which is correctly specified and confirmed against runtime.dataclasses_descriptors.tomlacross all checkers andresults.html; reconciledconformantflags that referenced the now-removed behavior.Fixes #2259
Test plan
uv run python src/main.py— reran full conformance suite, confirmed onlydataclasses_descriptorsresults changed for the intended checkersuv run python src/validate_results.py— 987 files validated, 0 invariant violationsconformance/tests/dataclasses_descriptors.py, the 4 affectedresults/*/dataclasses_descriptors.toml, andresults.html