[Python-Dev] Re: [Python-checkins] python/dist/src/Lib warnings.py,1.19,1.20

Skip Montanaro skip@pobox.com
Wed, 14 May 2003 13:14:43 -0500


    Skip> I'll see what I can come up with and submit a patch.

Okay, this seems too simple. ;-) There's no need to compile the message and
module arguments to filterwarnings.  Just store them as strings and call
re.match() later with the appropriate args.  That takes care of that one.  I
think use of the -W command line flag is infrequent enough that it doesn't
really matter that _processoptions, _setoption and -getcategory might get
called at startup.  Most of the time sys.warnoptions will be an empty list,
so _setoption and _getcategory won't be called.

Aside: Why are message and module names given on the command line treated as
literal strings while message and module names which are passed directly to
filterwarnings() treated as regular expressions?  If they were treated as
regular expressions, the calls to re.escape() could be removed and
_setoptions wouldn't use re either.

Skip