FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.11] bpo-42272: fix misleading warning filter message/module docs (GH-23172) by miss-islington · Pull Request #93342 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 10 additions & 6 deletions Doc/library/warnings.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,19 @@ the disposition of the match. Each entry is a tuple of the form (*action*,
+---------------+----------------------------------------------+

* *message* is a string containing a regular expression that the start of
the warning message must match. The expression is compiled to always be
case-insensitive.
the warning message must match, case-insensitively. In :option:`-W` and
:envvar:`PYTHONWARNINGS`, *message* is a literal string that the start of the
warning message must contain (case-insensitively), ignoring any whitespace at
the start or end of *message*.

* *category* is a class (a subclass of :exc:`Warning`) of which the warning
category must be a subclass in order to match.

* *module* is a string containing a regular expression that the module name must
match. The expression is compiled to be case-sensitive.
* *module* is a string containing a regular expression that the start of the
fully-qualified module name must match, case-sensitively. In :option:`-W` and
:envvar:`PYTHONWARNINGS`, *module* is a literal string that the
fully-qualified module name must be equal to (case-sensitively), ignoring any
whitespace at the start or end of *module*.

* *lineno* is an integer that the line number where the warning occurred must
match, or ``0`` to match all line numbers.
Expand Down Expand Up @@ -207,8 +212,7 @@ Some examples::
error::ResourceWarning # Treat ResourceWarning messages as errors
default::DeprecationWarning # Show DeprecationWarning messages
ignore,default:::mymodule # Only report warnings triggered by "mymodule"
error:::mymodule[.*] # Convert warnings to errors in "mymodule"
# and any subpackages of "mymodule"
error:::mymodule # Convert warnings to errors in "mymodule"


.. _default-warning-filter:
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Clarify that :option:`-W` and :envvar:`PYTHONWARNINGS` are matched literally
and case-insensitively, rather than as regular expressions, in
:mod:`warnings`.

Back | FazBrowse Home | New Git URL