Skip to content

Commit 78e1d65

Browse files
gh-140241: Fix documentation for the registry parameter of warnings.warn_explicit() (GH-140242)
Co-authored-by: Petr Viktorin <[email protected]>
1 parent 936de25 commit 78e1d65

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

482482
This is a low-level interface to the functionality of :func:`warn`, passing in
483-
explicitly the message, category, filename and line number, and optionally the
484-
module name and the registry (which should be the ``__warningregistry__``
485-
dictionary of the module). The module name defaults to the filename with
486-
``.py`` stripped; if no registry is passed, the warning is never suppressed.
483+
explicitly the message, category, filename and line number, and optionally
484+
other arguments.
487485
*message* must be a string and *category* a subclass of :exc:`Warning` or
488486
*message* may be a :exc:`Warning` instance, in which case *category* will be
489487
ignored.
490488

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

0 commit comments

Comments
 (0)