Skip to content

Commit

Permalink
Adjust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Nov 29, 2023
1 parent e323502 commit acf49b3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Doc/library/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ Available Functions
Decorator to indicate that a class, function or overload is deprecated.

When this decorator is applied to an object,
deprecation warnings may be emitted at runtime when the object is used.
:term:`static type checkers <static type checker>`
will generate a diagnostic on usage of the deprecated object.

will also generate a diagnostic on usage of the deprecated object.
Usage::

from warnings import deprecated
Expand All @@ -549,14 +549,16 @@ Available Functions
@overload
def g(x: str) -> int: ...

The warning specified by *category* will be emitted on use
of deprecated objects. For functions, that happens on calls;
The warning specified by *category* will be emitted at runtime
on use of deprecated objects. For functions, that happens on calls;
for classes, on instantiation and on creation of subclasses.
If the *category* is ``None``,
no warning is emitted. The *stacklevel* determines where the
If the *category* is ``None``, no warning is emitted at runtime.
The *stacklevel* determines where the
warning is emitted. If it is ``1`` (the default), the warning
is emitted at the direct caller of the deprecated object; if it
is higher, it is emitted further up the stack.
Static type checker behavior is not affected by the *category*
and *stacklevel* arguments.

The deprecation message passed to the decorator is saved in the
``__deprecated__`` attribute on the decorated object.
Expand Down

0 comments on commit acf49b3

Please sign in to comment.