FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove questionable dataclass descriptor conformance assertions by BHUVANSH855 · Pull Request #2296 · python/typing · GitHub

/ typing Public

Remove questionable dataclass descriptor conformance assertions - #2296

Closed
BHUVANSH855 wants to merge 3 commits into
python:mainfrom
BHUVANSH855:fix-2259-dataclass-descriptor-tests
Closed

Remove questionable dataclass descriptor conformance assertions#2296
BHUVANSH855 wants to merge 3 commits into
python:mainfrom
BHUVANSH855:fix-2259-dataclass-descriptor-tests

Conversation

Copy link
Copy Markdown
Contributor

Summary

Remove questionable Desc2 conformance assertions from dataclasses_descriptors.py.

The existing assertions do not align with actual runtime behavior for non-data descriptors in dataclasses:

  • DC2.x and DC2.y raise AttributeError at runtime because no descriptor instance exists in the class dictionary for those fields.
  • dc2.x and dc2.y evaluate to the stored Desc2 instances because non-data descriptors are shadowed by instance attributes.
  • The z case is also subtle due to descriptor access during dataclass default extraction.

Since this behavior is currently under-specified and differs across type checkers and runtime semantics, this PR removes the questionable assertions and replaces them with explanatory comments.

Fixes #2259

BHUVANSH855 force-pushed the fix-2259-dataclass-descriptor-tests branch from aee0e78 to 15e4fe0 Compare May 28, 2026 17:26
BHUVANSH855 force-pushed the fix-2259-dataclass-descriptor-tests branch from 15e4fe0 to c48ab35 Compare May 28, 2026 17:29
BHUVANSH855 force-pushed the fix-2259-dataclass-descriptor-tests branch from 09c8961 to d6caba9 Compare May 28, 2026 17:40
srittau added the topic: conformance tests Issues with the conformance test suite label May 29, 2026

Copy link
Copy Markdown
Collaborator

Closing, because there is also #2299, which seems more promising and tries to fix the exact same issue.

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

Labels

topic: conformance tests Issues with the conformance test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conformance suite: Questionable tests in dataclasses_descriptors.py

3 participants


Back | FazBrowse Home | New Git URL