Skip to content
11 changes: 7 additions & 4 deletions Doc/library/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,13 @@ Available Context Managers

A context manager that copies and, upon exit, restores the warnings filter
and the :func:`showwarning` function.
If the *record* argument is :const:`False` (the default) the context manager
returns :class:`None` on entry. If *record* is :const:`True`, a list is
returned that is progressively populated with objects as seen by a custom
:func:`showwarning` function (which also suppresses output to ``sys.stdout``).

If the *record* argument is false (the default) the context manager
returns ``None`` on entry.
If *record* is true, the :func:`showwarning` function is temporarily reset
to the default implementation and a list is returned that is progressively
populated with objects as seen by the :func:`!showwarning` function
(which also suppresses output to ``sys.stderr`` and other streams).
Each object in the list has attributes with the same names as the arguments to
:func:`showwarning`.

Expand Down
Loading