diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-12-25 22:51:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-25 22:51:22 (GMT) |
commit | a5deabd8e43a76bf2d7923342b6c4395c1a5efcd (patch) | |
tree | f1e684acca889a2b3c4996845a787a41b20439dc | |
parent | ff67612fa3c947c1dcc0a4cb0b55ee472b7edc66 (diff) | |
download | cpython-a5deabd8e43a76bf2d7923342b6c4395c1a5efcd.zip cpython-a5deabd8e43a76bf2d7923342b6c4395c1a5efcd.tar.gz cpython-a5deabd8e43a76bf2d7923342b6c4395c1a5efcd.tar.bz2 |
bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677)
(cherry picked from commit e28aff54d95236ea1b64b648d89a1516e446e621)
Co-authored-by: Fabio Sangiovanni <4040184+sanjioh@users.noreply.github.com>
-rw-r--r-- | Doc/library/dataclasses.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 9aa4a19..37258d4 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -60,8 +60,9 @@ Module-level decorators, classes, and functions The :func:`dataclass` decorator will add various "dunder" methods to the class, described below. If any of the added methods already - exist on the class, a :exc:`TypeError` will be raised. The decorator - returns the same class that is called on: no new class is created. + exist on the class, the behavior depends on the parameter, as documented + below. The decorator returns the same class that is called on; no new + class is created. If :func:`dataclass` is used just as a simple decorator with no parameters, it acts as if it has the default values documented in this @@ -115,7 +116,7 @@ Module-level decorators, classes, and functions If the class already defines any of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then - :exc:`ValueError` is raised. + :exc:`TypeError` is raised. - ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method is generated according to how ``eq`` and ``frozen`` are set. |