Message28861
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? |
|
| Date |
User |
Action |
Args |
| 2007-08-23 14:40:45 | admin | link | issue1510580 messages |
| 2007-08-23 14:40:45 | admin | create | |
|