Skip to content

Commit 762fbdb

Browse files
miss-islingtonserhiy-storchakaencukou
authored
[3.13] pythongh-140241: Fix documentation for the registry parameter of warnings.warn_explicit() (pythonGH-140242) (pythonGH-140293)
(cherry picked from commit 78e1d65) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
1 parent 0231a39 commit 762fbdb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Doc/library/warnings.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,21 @@ Available Functions
469469
.. function:: warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None, source=None)
470470

471471
This is a low-level interface to the functionality of :func:`warn`, passing in
472-
explicitly the message, category, filename and line number, and optionally the
473-
module name and the registry (which should be the ``__warningregistry__``
474-
dictionary of the module). The module name defaults to the filename with
475-
``.py`` stripped; if no registry is passed, the warning is never suppressed.
472+
explicitly the message, category, filename and line number, and optionally
473+
other arguments.
476474
*message* must be a string and *category* a subclass of :exc:`Warning` or
477475
*message* may be a :exc:`Warning` instance, in which case *category* will be
478476
ignored.
479477

478+
*module*, if supplied, should be the module name.
479+
If no module is passed, the filename with ``.py`` stripped is used.
480+
481+
*registry*, if supplied, should be the ``__warningregistry__`` dictionary
482+
of the module.
483+
If no registry is passed, each warning is treated as the first occurrence,
484+
that is, filter actions ``"default"``, ``"module"`` and ``"once"`` are
485+
handled as ``"always"``.
486+
480487
*module_globals*, if supplied, should be the global namespace in use by the code
481488
for which the warning is issued. (This argument is used to support displaying
482489
source for modules found in zipfiles or other non-filesystem import

0 commit comments

Comments
 (0)