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

[3.11] bpo-42272: fix misleading warning filter message/module docs (GH-23172) - #93342

Merged
miss-islington merged 1 commit into
python:3.11from
miss-islington:backport-8136606-3.11
May 30, 2022
Merged

miss-islington merged 1 commit into
python:3.11from
miss-islington:backport-8136606-3.11

Conversation

Copy link
Copy Markdown
Contributor
  • bpo-42272: improve message/module warning filter docs

"The Warnings Filter" section of the warnings module documentation
describes the message and module filters as "a string containing a
regular expression". While that is true when they are arguments to the
filterwarnings function, it is not true when they appear in -W or
$PYTHONWARNINGS where they are matched literally (after stripping any
starting/ending whitespace). Update the documentation to note when they
are matched literally. Also clarify that module matches the
"fully-qualified module name", rather than "module name" which is
ambiguous.

skip news (since this is a doc fix)

Signed-off-by: Kevin Locke kevin@kevinlocke.name

  • bpo-42272: remove bad submodule warning filter doc

The error:::mymodule[.*] example in the "Describing Warning Filters"
section of the warnings module documentation does not behave as the
comment describes. Since the module portion of the filter string is
interpreted literally, it would match a module with a fully-qualified
name that is literally mymodule[.*].

Unfortunately, there is not a way to match '"module" and any subpackages
of "mymodule"' as documented, since the module part of a filter string
is matched literally. Instead, update the filter and comment to match
only "mymodule".

skip news (since this is a doc fix)

Signed-off-by: Kevin Locke kevin@kevinlocke.name

  • bpo-42272: add warning filter doc changes to NEWS

Signed-off-by: Kevin Locke kevin@kevinlocke.name
(cherry picked from commit 8136606)

Co-authored-by: Kevin Locke kevin@kevinlocke.name

…H-23172)

* bpo-42272: improve message/module warning filter docs

"The Warnings Filter" section of the warnings module documentation
describes the message and module filters as "a string containing a
regular expression".  While that is true when they are arguments to the
filterwarnings function, it is not true when they appear in -W or
$PYTHONWARNINGS where they are matched literally (after stripping any
starting/ending whitespace).  Update the documentation to note when they
are matched literally.  Also clarify that module matches the
"fully-qualified module name", rather than "module name" which is
ambiguous.

skip news (since this is a doc fix)

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>

* bpo-42272: remove bad submodule warning filter doc

The `error:::mymodule[.*]` example in the "Describing Warning Filters"
section of the warnings module documentation does not behave as the
comment describes.  Since the module portion of the filter string is
interpreted literally, it would match a module with a fully-qualified
name that is literally `mymodule[.*]`.

Unfortunately, there is not a way to match '"module" and any subpackages
of "mymodule"' as documented, since the module part of a filter string
is matched literally.  Instead, update the filter and comment to match
only "mymodule".

skip news (since this is a doc fix)

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>

* bpo-42272: add warning filter doc changes to NEWS

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
(cherry picked from commit 8136606)

Co-authored-by: Kevin Locke <kevin@kevinlocke.name>

Copy link
Copy Markdown
Contributor Author

Status check is done, and it's a success ✅ .

Copy link
Copy Markdown
Contributor Author

Status check is done, and it's a success ✅ .

miss-islington merged commit cc31cfc into python:3.11 May 30, 2022
miss-islington deleted the backport-8136606-3.11 branch May 30, 2022 02:04
ezio-melotti self-assigned this May 30, 2022

Copy link
Copy Markdown
Contributor Author

Status check is done, and it's a success ✅ .

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL