Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Doc/library/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ Available Functions
and calls to :func:`simplefilter`.


.. decorator:: deprecated(msg, *, category=DeprecationWarning, stacklevel=1)
.. decorator:: deprecated(message, *, category=DeprecationWarning, stacklevel=1)

Decorator to indicate that a class, function or overload is deprecated.

Expand Down Expand Up @@ -612,6 +612,18 @@ Available Functions
for the attribute to exist on the overload as returned by
:func:`typing.get_overloads`.

``deprecated`` is implemented as a class, so applying it (for example,
``deprecated("Use B instead")``) returns an instance that acts as the
decorator. The arguments passed to it are available as attributes of the
same names on that instance:

* ``message``: the deprecation message (a :class:`str`; a
:exc:`TypeError` is raised if it is not).
* ``category``: the warning category, or ``None`` if no runtime warning
should be emitted.
* ``stacklevel``: the number of stack frames to skip when emitting the
warning (an :class:`int`).

.. versionadded:: 3.13
See :pep:`702`.

Expand Down
Loading