Extension types as exceptions
mal at lemburg.com
Thu Aug 12 21:06:14 CEST 1999
Daniel Dittmar wrote:
> Should it be possible to use extension types (implemented in C) as
Good question. Even though it makes more sense to subclass the
ones in exceptions.py (this is possible from within C too) and
then include any additional information in the parameters, it should
basically be possible to "raise" any object as exception just like
> Currently, this works partly, as you can 'raise' and 'except' them.
> It doesn't work in the following code:
> ... code raising exception
> except EOFException, err:
The code you show here doesn't have anything to do with this. The
functionality would have to be added to Python/errors.c and ceval.c
(plus maybe other files).
> When the exception doesn't match any 'except' clause, it seems to be
> reraised through the following code in ceval.c:
> case END_FINALLY:
> Only strings and python classes seem to be allowed.
Strings, classes and instances are allowed.
Hope that helps.
Y2000: 141 days left
Python Pages: http://www.lemburg.com/python/
More information about the Python-list