A feature request, and, Re: [C++-sig] Re: Exception translation to python classes

Niall Douglas s_sourceforge at nedprod.com
Tue Sep 23 05:07:24 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 23 Sep 2003 at 9:17, Lijun Qin wrote:

> form of code, you need to use the PyErr_NewException() API to create a
> new exception class derived from PyExc_Exception class. And to create
> '__init__' and '__str__' function, you also need to create two method
> object for two callable object. I have managed to make it work, but it
> need a lot of handcraft.

Thanks for telling me this, you've just saved me a day of work. Dave, 
what do you think?

> I this process, I have found that if boost.python can support
> specifing an existing Python class as base class (or one of the
> basses), such as specify 'PyExc_Excetion' as the base class of the
> generated python class, it'll be a much simpler life for us.

I agree. But it's not crucial for what I need, so I'll have my 
exception class generate a textual description and report that to 
python (ie; I'm going to cheat :) )

Cheers,
Niall





-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2

iQA/AwUBP2+47MEcvDLFGKbPEQKvCgCgwakEJYQp2pcr2g/JqqzZkW1LiVMAn30b
wg9jEFvGmW25lYbrcCQYBv6F
=bEB8
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list