[Python-Dev] Exceptions *must*? be old-style classes?

Michael Hudson mwh at python.net
Tue Feb 15 16:49:49 CET 2005


Michael Hudson <mwh at python.net> writes:

> Michael Hudson <mwh at python.net> writes:
>
>> I hope to have a new patch (which makes PyExc_Exception new-style, but
>> allows arbitrary old-style classes as exceptions) "soon".  It may even
>> pass bits of "make test" :)
>
> Done: http://www.python.org/sf/1104669

Now I think it's really done, apart from documentation.

My design decision was to make Exception new-style.  Things can be
raised if they are instances of old-style classes or instances of
Exception.  If this meets with general agreement, I'd like to check
the above patch in.  It will break some highly introspective code, so
it's IMO best to get it in early in the 2.5 cycle.

The other option is to keep Exception old-style but allow new-style
subclasses, but I think all this will do is break the above mentioned
introspective code in a quieter way...

The patch also updates the PendingDeprecationWarning on raising a
string exception to a full DeprecationWarning (something that should
be done anyway).

Cheers,
mwh

-- 
  python py.py ~/Source/python/dist/src/Lib/test/pystone.py
  Pystone(1.1) time for 5000 passes = 19129.1
  This machine benchmarks at 0.261381 pystones/second


More information about the Python-Dev mailing list