[Cython] [cython-users] C++: how to handle failures of 'new'?

mark florisson markflorisson88 at gmail.com
Sun Jul 8 13:42:23 CEST 2012


On 8 July 2012 11:17, Stefan Behnel <stefan_ml at behnel.de> wrote:
> mark florisson, 08.07.2012 11:34:
>> On 8 July 2012 08:59, Robert Bradshaw wrote:
>>> On Fri, Jul 6, 2012 at 2:33 AM, mark florisson wrote:
>>>> On 6 July 2012 03:34, Dag Sverre Seljebotn wrote:
>>>>> I'm not sure if I like C++ exceptions internally in Cython myself.
>>>>> It would mean that C-compiled Cython modules would not be able to call
>>>>> C++-compiled Cython modules, which I think would create a lot of headache.
>>>>> And I think we want to keep the ability to compile with a C compiler if you
>>>>> don't call C++ code...
>>>>
>>>> I don't know how often people mix the two. It's probably not worth
>>>> making a directive either... Are there any platforms where installing
>>>> a C++ compiler is more of a hassle than a C compiler? E.g. Theano
>>>> depends on a C++ compiler (and a lot more as well).
>>>
>>> Are you implying, for example, that one would have to re-compile NumPy
>>> with a C++ compiler if you wanted to use any C++ extension modules?
>>> I'd rather avoid this.
>>
>> No, you can still freely mix any extension modules, it's just that
>> when you cimport stuff from other Cython modules, they have to be ABI
>> compatible. If C++ is part of the ABI due to how exceptions are
>> propagated and handled, then those modules need to be compiled both
>> with C++ (or neither, to get the other semantics with slower (to be
>> verified) error checks).
>
> -1. I don't want to prevent users of the public C-API of lxml from talking
> to C++ code in their own modules.
>
> Stefan
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel

I think you misunderstand. This would only be part of the internal
Cython ABI. If you use public/api functions, or take the pointer to
the function, you get the C semantics (possibly with unraisable
exceptions). The details are in the CEP, this would only replace the
extra 'error' argument to cdef functions.


More information about the cython-devel mailing list