Skip to content

Commit 512f299

Browse files
authored
gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109)
1 parent 219effa commit 512f299

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Doc/library/dataclasses.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ for ``x`` when creating a class instance will share the same copy
738738
of ``x``. Because dataclasses just use normal Python class
739739
creation they also share this behavior. There is no general way
740740
for Data Classes to detect this condition. Instead, the
741-
:func:`dataclass` decorator will raise a :exc:`TypeError` if it
741+
:func:`dataclass` decorator will raise a :exc:`ValueError` if it
742742
detects an unhashable default parameter. The assumption is that if
743743
a value is unhashable, it is mutable. This is a partial solution,
744744
but it does protect against many common errors.

0 commit comments

Comments
 (0)