Bugs item #1510580, was opened at 2006-06-22 08:20 Message generated for change (Comment added) made by akuchling You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1510580&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: A.M. Kuchling (akuchling) Assigned to: Brett Cannon (bcannon) Summary: Setting category fails with -W switch Initial Comment: 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? ---------------------------------------------------------------------- >Comment By: A.M. Kuchling (akuchling) Date: 2006-06-22 09:50 Message: Logged In: YES user_id=11375 Once the problem is fixed, the attached patch adds some tests for warning parsing. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1510580&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com