Cython currently segfaults when using a buffer in nogil and accessing 
out of bounds (which triggers an IndexError). This is a bug, however I 
would like to do more than disallow it.

I.e. what should happen here:

     cdef object[int] buf = ... # buffer of length < 6
     with nogil:
         buf[5] = 0

Option 1) Reacquire the GIL temporarily to construct the IndexError 
instance. This seems to work wonderfully in my current patch; but is it 
too unintuitive to raise an exception from an operation in a nogil 
section? Will any other operation trigger an exception within a nogil 
section?

Option 2) Only allow buffer use in nogil if @cython.boundscheck(False). 
This has some usability problems; it would be a pain to turn on/off 
nogil for debugging.

Option 3) Print to standard output using printf instead of raising 
exception.



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

Reply via email to