[Python-Dev] Deprecating string exceptions
Fri, 5 Apr 2002 18:51:48 -0500
>>>>> "MvL" == Martin v Loewis <firstname.lastname@example.org> writes:
MvL> http://python.org/sf/518846 reports that new-style classes
MvL> cannot be used as exceptions. I think it is desirable that this
MvL> is fixed, but I also believe that it conflicts with string
MvL> exceptions. So I would like to propose that string exceptions
MvL> are deprecated for Python 2.3, in order to remove them in
MvL> Python 2.4, simultaneously allowing arbitrary objects as
I didn't read most of this length thread the first time through, but I
did run into the bug today in my own code and tried to fix it. I
added a patch to 518846 that allows instances of new style classes,
where the check is implemented by checking Py_TPFLAGS_HEAPTYPE, which
is only defined for objects created by class statements (I think).
This doesn't seem to cause any change in the behavior of string-based
exceptions. I don't think it's necessary to have "except str:" catch
string-based exceptions, because they're supported solely for
There was also some discussion of making exceptions inherit from
Exception, but I think that's a separate issue.
Any reason not to commit the patch?