Author akuchling
Recipients
Date 2006-06-22.12:20:11
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This command reports an "invalid warning category"
error, but it shouldn't.

./python -W'ignore:Not importing directory:ImportWarning'

I think the change to new-style exceptions exposed this
problem.  warnings.py contains the following code to
trigger this error:

    if (not isinstance(cat, types.ClassType) or
        not issubclass(cat, Warning)):
        raise _OptionError("invalid warning category:
%r" % (category,))

The new-style exceptions mean that the first
isinstance() now returns False.   I think there may be
two fixes needed.  First, I think it should be
"isinstance(cat, types.ClassType) or isinstance(cat,
type)".

Second issue: hould the warnings.py code use "and"
instead of "or"?  Surely if issubclass(cat, Warning) is
True, the category is certainly OK; no?
History
Date User Action Args
2007-08-23 14:40:45adminlinkissue1510580 messages
2007-08-23 14:40:45admincreate