[Python-bugs-list] [ python-Bugs-518846 ] exception cannot be new-style class
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 17 Feb 2002 15:44:13 -0800
Bugs item #518846, was opened at 2002-02-17 12:09
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=518846&group_id=5470
Category: Type/class unification
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Magnus Heino (magnusheino)
Assigned to: Nobody/Anonymous (nobody)
Summary: exception cannot be new-style class
Initial Comment:
[magnus@gills magnus]$ python2.2
Python 2.2 (#1, Jan 26 2002, 14:27:24)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class foo(object):
... pass
...
>>> raise foo()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: exceptions must be strings, classes, or instances, not foo
>>>
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2002-02-17 15:44
Message:
Logged In: YES
user_id=21627
Interesting. I think we need to deprecate, then remove
string exception before allowing arbitrary objects as
exceptions. Or we could allow strings to be caught either by
__builtin__.str, or by an identical string.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=518846&group_id=5470