[Cython] Higher fidelity translations from C++ exception to Python exception?
Barry Warsaw
barry at python.org
Sat Jul 7 00:05:09 CEST 2012
On Jul 06, 2012, at 11:59 PM, Dag Sverre Seljebotn wrote:
>>The generated code does a `catch(...)` so you lose that useful information.
>>AFAICT, there's no way to find out within the catch clause (or anything
>>called by that clause) what C++ exception occurred.
>
>But that requires something more than a catch(...), right? There must be more
>syntax introduced in the Cython language to map C++ exceptions to constructor
>functions (taking exceptions of different types). Do you have a concrete
>proposal for how that could look like?
What about:
cdef void raise_fooexc(e) except *:
raise MyPythonError(e.detail_1, e.detail_2)
cdef func(self) except +raise_fooexc(exception_type):
something_that_raises_exception_type()
?
Then `exception_type` would get stuffed inside the catch() instead of ...
Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20120706/967f1ebd/attachment.pgp>
More information about the cython-devel
mailing list