bpo-33961: Adjusted dataclasses docs to correct exceptions raised. (GH-7917) (GH-17677)

This commit is contained in:
Fabio Sangiovanni 2019-12-25 23:45:30 +01:00 committed by Eric V. Smith
parent 527f9de6ef
commit e28aff54d9

View file

@ -60,8 +60,9 @@ Module-level decorators, classes, and functions
The :func:`dataclass` decorator will add various "dunder" methods to The :func:`dataclass` decorator will add various "dunder" methods to
the class, described below. If any of the added methods already the class, described below. If any of the added methods already
exist on the class, a :exc:`TypeError` will be raised. The decorator exist on the class, the behavior depends on the parameter, as documented
returns the same class that is called on: no new class is created. 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, 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 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__`, If the class already defines any of :meth:`__lt__`,
:meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then :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 - ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method
is generated according to how ``eq`` and ``frozen`` are set. is generated according to how ``eq`` and ``frozen`` are set.