Skip to content

Commit 2f350ef

Browse files
serhiy-storchakaencukou
authored andcommitted
gh-140241: Fix documentation for the registry parameter of warnings.warn_explicit() (GH-140242)
(cherry picked from commit 78e1d65) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
1 parent 128f48f commit 2f350ef

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
@@ -476,14 +476,21 @@ Available Functions
476476
.. function:: warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None, source=None)
477477

478478
This is a low-level interface to the functionality of :func:`warn`, passing in
479-
explicitly the message, category, filename and line number, and optionally the
480-
module name and the registry (which should be the ``__warningregistry__``
481-
dictionary of the module). The module name defaults to the filename with
482-
``.py`` stripped; if no registry is passed, the warning is never suppressed.
479+
explicitly the message, category, filename and line number, and optionally
480+
other arguments.
483481
*message* must be a string and *category* a subclass of :exc:`Warning` or
484482
*message* may be a :exc:`Warning` instance, in which case *category* will be
485483
ignored.
486484

485+
*module*, if supplied, should be the module name.
486+
If no module is passed, the filename with ``.py`` stripped is used.
487+
488+
*registry*, if supplied, should be the ``__warningregistry__`` dictionary
489+
of the module.
490+
If no registry is passed, each warning is treated as the first occurrence,
491+
that is, filter actions ``"default"``, ``"module"`` and ``"once"`` are
492+
handled as ``"always"``.
493+
487494
*module_globals*, if supplied, should be the global namespace in use by the code
488495
for which the warning is issued. (This argument is used to support displaying
489496
source for modules found in zipfiles or other non-filesystem import

0 commit comments

Comments
 (0)