Custom C Exception Subclasses

Ross rlight2 at gmail.com
Wed Dec 24 10:42:38 EST 2008


For a project that I am doing, it would be useful to have an exception
class that stores some additional data along with the message.
However, I want to be able to store a couple pointers to C++ classes,
so I can't just use an exception created with PyExc_NewException.  If
I were to subclass the built-in Exception type, I would need to have
access to the PyExc_ExceptionObject, but the headers only give
PyExc_Exception, the type object.  This seems like a rather
straightforward task, but I can't seem to find any documentation for
it.  Does anyone know how to do this?  Thanks!



More information about the Python-list mailing list