diff options
Diffstat (limited to 'Doc/library/warnings.rst')
-rw-r--r-- | Doc/library/warnings.rst | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst index 289b282..f7a1f70 100644 --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -491,7 +491,7 @@ Available Functions Available Context Managers -------------------------- -.. class:: catch_warnings(*, record=False, module=None) +.. class:: catch_warnings(*, record=False, module=None, action=None, category=Warning, lineno=0, append=False) A context manager that copies and, upon exit, restores the warnings filter and the :func:`showwarning` function. @@ -507,6 +507,10 @@ Available Context Managers protected. This argument exists primarily for testing the :mod:`warnings` module itself. + If the *action* argument is not ``None``, the remaining arguments are + passed to :func:`simplefilter` as if it were called immediately on + entering the context. + .. note:: The :class:`catch_warnings` manager works by replacing and @@ -514,3 +518,7 @@ Available Context Managers :func:`showwarning` function and internal list of filter specifications. This means the context manager is modifying global state and therefore is not thread-safe. + + .. versionchanged:: 3.11 + + Added the *action*, *category*, *lineno*, and *append* parameters. |