Skip to content

Commit 97cf029

Browse files
[3.11] gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109) (gh-106116)
gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109) (cherry picked from commit 512f299) Co-authored-by: Roderich Schupp <[email protected]>
1 parent 307c59a commit 97cf029

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
@@ -733,7 +733,7 @@ for ``x`` when creating a class instance will share the same copy
733733
of ``x``. Because dataclasses just use normal Python class
734734
creation they also share this behavior. There is no general way
735735
for Data Classes to detect this condition. Instead, the
736-
:func:`dataclass` decorator will raise a :exc:`TypeError` if it
736+
:func:`dataclass` decorator will raise a :exc:`ValueError` if it
737737
detects an unhashable default parameter. The assumption is that if
738738
a value is unhashable, it is mutable. This is a partial solution,
739739
but it does protect against many common errors.

0 commit comments

Comments
 (0)