Skip to content

Commit a5deabd

Browse files
bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677)
(cherry picked from commit e28aff5) Co-authored-by: Fabio Sangiovanni <[email protected]>
1 parent ff67612 commit a5deabd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/library/dataclasses.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ Module-level decorators, classes, and functions
6060

6161
The :func:`dataclass` decorator will add various "dunder" methods to
6262
the class, described below. If any of the added methods already
63-
exist on the class, a :exc:`TypeError` will be raised. The decorator
64-
returns the same class that is called on: no new class is created.
63+
exist on the class, the behavior depends on the parameter, as documented
64+
below. The decorator returns the same class that is called on; no new
65+
class is created.
6566

6667
If :func:`dataclass` is used just as a simple decorator with no parameters,
6768
it acts as if it has the default values documented in this
@@ -115,7 +116,7 @@ Module-level decorators, classes, and functions
115116

116117
If the class already defines any of :meth:`__lt__`,
117118
:meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then
118-
:exc:`ValueError` is raised.
119+
:exc:`TypeError` is raised.
119120

120121
- ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method
121122
is generated according to how ``eq`` and ``frozen`` are set.

0 commit comments

Comments
 (0)