From: Fabio Sangiovanni <4040184+sanjioh@users.noreply.github.com> Date: Wed, 25 Dec 2019 22:45:30 +0000 (+0100) Subject: bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH... X-Git-Tag: v3.9.0a3~191 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e28aff54d95236ea1b64b648d89a1516e446e621;p=thirdparty%2FPython%2Fcpython.git bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677) --- diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 71768abf80c4..c125a1130a96 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.