Re: [capi-sig] [Fwd: Re: Exceptions with additional instance variables]
22 Dec
2008
22 Dec
'08
7:32 p.m.
2008/12/22 Stefan Behnel <python_capi@behnel.de>:
The quick way to fix your problem might be to write the exception code in Cython like thís:
class MyException(Exception): def __init__(self, errorcode, message): super(MyException, self).__init__(self, message) self.errorcode = errorcode
and use that instead. You can also make it an exception class if you like, by declaring the Exception class as an external type (requires Py2.5+). In this case, Cython can generate a header file for you that declares your new extension type.
Hello Stefan,
thanks for the tip, I'll surely look at Cython and how it can help ;-) Thanks for the pointer and for the example!
Regards, Chojrak
5740
Age (days ago)
5740
Last active (days ago)
0 comments
1 participants
participants (1)
-
chojrak11@gmail.com