This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: No documentation for the module argument to warnings.filterwarnings
Type: Stage:
Components: Documentation Versions: Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: exarkun, georg.brandl
Priority: normal Keywords:

Created on 2009-09-05 15:44 by exarkun, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg92280 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-09-05 15:44
None of the documentation seems to cover this parameter.  The test suite
doesn't even seem to exercise it, either.  What does it do?  What kind
of values are expected to be passed for it?
msg92282 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-09-05 16:47
The values for a filter entry are documented under the "The Warnings
Filter" heading.  I've added a link to it from filterwarnings in r74671.
msg92286 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-09-05 17:57
Thanks for that Georg.

I'm still having trouble with this.  I'm aware that the issue tracking
isn't the right place to ask for help with writing programs, but I think
that since I still can't get this code to work, even looking at the new
documentation, there is still a documentation issue.  Perhaps there's
something else I'm doing wrong, though.

The code causing the warning to be emitted is here:

http://twistedmatrix.com/trac/browser/trunk/twisted/conch/ssh/filetransfer.py?rev=27062#L829

It's a simple example of the new-in-2.6 BaseException.message
deprecation warning.  I'm trying to suppress this.  My attempt goes
something like this:

warnings.filterwarnings(
    'ignore',
    message='BaseException.message has been deprecated as of Python 2.6',
    category=DeprecationWarning,
    module=r'twisted\.conch\.ssh\.filetransfer')

When I remove the module argument from this call, the warning is
suppressed.  When I include it, it is not.  The string given seems to be
"a string containing a regular expression that the module name must
match", the meaning the documentation suggests.  Am I just doing
something wrong, or are the docs still not right?
msg92291 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-09-05 18:45
A simple isolated test here shows that the module argument works as
intended.  I can't help with your problem without more information (but
you probably should debug this somewhere in warnings.py/_warnings.c). 
But you're right, this is not a subject for the bugtracker anymore :)
History
Date User Action Args
2022-04-11 14:56:52adminsetgithub: 51092
2009-09-05 18:45:02georg.brandlsetstatus: open -> closed

messages: + msg92291
2009-09-05 17:57:55exarkunsetstatus: closed -> open

messages: + msg92286
2009-09-05 16:47:24georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg92282
2009-09-05 15:44:29exarkuncreate