Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6220c02

Browse files
authored
bpo-35563: Add reference links to warnings.rst (GH-11289)
1 parent bf457c7 commit 6220c02

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

Doc/library/warnings.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Python programmers issue warnings by calling the :func:`warn` function defined
1919
in this module. (C programmers use :c:func:`PyErr_WarnEx`; see
2020
:ref:`exceptionhandling` for details).
2121

22-
Warning messages are normally written to ``sys.stderr``, but their disposition
22+
Warning messages are normally written to :data:`sys.stderr`, but their disposition
2323
can be changed flexibly, from ignoring all warnings to turning them into
24-
exceptions. The disposition of warnings can vary based on the warning category
25-
(see below), the text of the warning message, and the source location where it
24+
exceptions. The disposition of warnings can vary based on the :ref:`warning category
25+
<warning-categories>`, the text of the warning message, and the source location where it
2626
is issued. Repetitions of a particular warning for the same source location are
2727
typically suppressed.
2828

@@ -31,7 +31,7 @@ determination is made whether a message should be issued or not; next, if a
3131
message is to be issued, it is formatted and printed using a user-settable hook.
3232

3333
The determination whether to issue a warning message is controlled by the
34-
warning filter, which is a sequence of matching rules and actions. Rules can be
34+
:ref:`warning filter <warning-filter>`, which is a sequence of matching rules and actions. Rules can be
3535
added to the filter by calling :func:`filterwarnings` and reset to its default
3636
state by calling :func:`resetwarnings`.
3737

@@ -181,9 +181,9 @@ Describing Warning Filters
181181
The warnings filter is initialized by :option:`-W` options passed to the Python
182182
interpreter command line and the :envvar:`PYTHONWARNINGS` environment variable.
183183
The interpreter saves the arguments for all supplied entries without
184-
interpretation in ``sys.warnoptions``; the :mod:`warnings` module parses these
184+
interpretation in :data:`sys.warnoptions`; the :mod:`warnings` module parses these
185185
when it is first imported (invalid options are ignored, after printing a
186-
message to ``sys.stderr``).
186+
message to :data:`sys.stderr`).
187187

188188
Individual warnings filters are specified as a sequence of fields separated by
189189
colons::
@@ -192,7 +192,7 @@ colons::
192192

193193
The meaning of each of these fields is as described in :ref:`warning-filter`.
194194
When listing multiple filters on a single line (as for
195-
:envvar:`PYTHONWARNINGS`), the individual filters are separated by commas,and
195+
:envvar:`PYTHONWARNINGS`), the individual filters are separated by commas and
196196
the filters listed later take precedence over those listed before them (as
197197
they're applied left-to-right, and the most recently applied filters take
198198
precedence over earlier ones).
@@ -395,12 +395,12 @@ Available Functions
395395
.. function:: warn(message, category=None, stacklevel=1, source=None)
396396

397397
Issue a warning, or maybe ignore it or raise an exception. The *category*
398-
argument, if given, must be a warning category class (see above); it defaults to
399-
:exc:`UserWarning`. Alternatively *message* can be a :exc:`Warning` instance,
398+
argument, if given, must be a :ref:`warning category class <warning-categories>`; it
399+
defaults to :exc:`UserWarning`. Alternatively, *message* can be a :exc:`Warning` instance,
400400
in which case *category* will be ignored and ``message.__class__`` will be used.
401-
In this case the message text will be ``str(message)``. This function raises an
401+
In this case, the message text will be ``str(message)``. This function raises an
402402
exception if the particular warning issued is changed into an error by the
403-
warnings filter see above. The *stacklevel* argument can be used by wrapper
403+
:ref:`warnings filter <warning-filter>`. The *stacklevel* argument can be used by wrapper
404404
functions written in Python, like this::
405405

406406
def deprecation(message):
@@ -444,7 +444,7 @@ Available Functions
444444

445445
Write a warning to a file. The default implementation calls
446446
``formatwarning(message, category, filename, lineno, line)`` and writes the
447-
resulting string to *file*, which defaults to ``sys.stderr``. You may replace
447+
resulting string to *file*, which defaults to :data:`sys.stderr`. You may replace
448448
this function with any callable by assigning to ``warnings.showwarning``.
449449
*line* is a line of source code to be included in the warning
450450
message; if *line* is not supplied, :func:`showwarning` will

0 commit comments

Comments
 (0)