[New-bugs-announce] [issue42272] Warning filter message/module documentation is misleading

Kevin Locke report at bugs.python.org
Thu Nov 5 15:06:37 EST 2020


New submission from Kevin Locke <kevin at kevinlocke.name>:

"The Warnings Filter" section of the documentation for the warnings module 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).

Additionally, in the "Describing Warning Filters" section, the example "error:::mymodule[.*]" does not behave as described.  If it were used as an argument to filterwarnings, where it would be treated as a regular expression, it would match the (invalid) module names mymodule. or mymodule* while it would match mymodule[.*] literally if passed via -W or $PYTHONWARNINGS.

----------
assignee: docs at python
components: Documentation
messages: 380429
nosy: docs at python, kevinoid
priority: normal
severity: normal
status: open
title: Warning filter message/module documentation is misleading
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42272>
_______________________________________


More information about the New-bugs-announce mailing list