]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106107: document correct error that's raised when a mutable default value for...
authorRoderich Schupp <roderich.schupp@gmail.com>
Mon, 26 Jun 2023 18:00:21 +0000 (20:00 +0200)
committerGitHub <noreply@github.com>
Mon, 26 Jun 2023 18:00:21 +0000 (14:00 -0400)
Doc/library/dataclasses.rst

index a5b2014992104201d3c28de66a90e104deefe9c5..535a60ccca8d07bdee4a978cdbf30dffaf9aed0f 100644 (file)
@@ -738,7 +738,7 @@ for ``x`` when creating a class instance will share the same copy
 of ``x``.  Because dataclasses just use normal Python class
 creation they also share this behavior.  There is no general way
 for Data Classes to detect this condition.  Instead, the
-:func:`dataclass` decorator will raise a :exc:`TypeError` if it
+:func:`dataclass` decorator will raise a :exc:`ValueError` if it
 detects an unhashable default parameter.  The assumption is that if
 a value is unhashable, it is mutable.  This is a partial solution,
 but it does protect against many common errors.