Skip to content

Commit aee0e78

Browse files
committed
Remove questionable dataclass descriptor conformance assertions
1 parent 94514b1 commit aee0e78

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

conformance/tests/dataclasses_descriptors.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ class DC2:
5858
z: Desc2[str] = Desc2()
5959

6060

61-
assert_type(DC2.x, list[int])
62-
assert_type(DC2.y, list[str])
63-
assert_type(DC2.z, list[str])
64-
65-
dc2 = DC2(Desc2(), Desc2(), Desc2())
66-
assert_type(dc2.x, int)
67-
assert_type(dc2.y, str)
68-
assert_type(dc2.z, str)
61+
# Runtime behavior involving non-data descriptors in dataclasses is
62+
# currently under-specified and differs across type checkers and runtime
63+
# implementations.
64+
#
65+
# In particular:
66+
# - DC2.x and DC2.y raise AttributeError at runtime because no descriptor
67+
# instance is stored in the class dictionary for those fields.
68+
# - dc2.x and dc2.y evaluate to the stored Desc2 instances because
69+
# non-data descriptors are shadowed by instance attributes.
70+
# - The behavior for z is also subtle because dataclasses access the
71+
# descriptor during default extraction.
72+
#
73+
# These cases are therefore omitted from the conformance suite until the
74+
# expected behavior is specified more clearly.

0 commit comments

Comments
 (0)