Greg Ewing wrote:
> Lisandro Dalcin wrote:
> 
>> The point is that NULL is not a valid return value, but MPI_COMM_NULL is.
> 
> In that case, you don't have a problem in the first
> place, because you *want* something that is not a
> valid return value.
> 
> Are you sure you understand what the 'except' clause
> is doing here? It *doesn't* cause an exception to be
> raised when the routine returns that value. It's an
> out-of-band value for Pyrex to use to indicate that
> the routine has, or may have, already raised an
> exception.
> 
> If you're calling an external routine, you need to
> check for whatever it uses to signal an error and raise
> and exception yourself. When you do that, Pyrex will
> use the exception value you've declared to signal
> that to calling Python-aware code.
> 
> The exception value is ideally a value that the routine
> can't ever return normally, or (with '?') one that
> it returns rarely. If the external routine is guaranteed
> never to return NULL, then that's an ideal unconditional
> exception value for your wrapper routine to use.

I believe the idea is that the routine doesn't return a pointer, but a 
struct or similar. Of course, also structs can have NULL-like values 
defined for them.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to