[Cython] buffer interface -- boundscheck

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Fri Nov 14 14:39:14 CET 2008


Uwe Schmitt wrote:
> Hi,
>
> I'm using the buffer interface and have a question concerning
> bound checks: The only way I now to avoid this is with
> a cython decorator like this:
>
> 	@cython.boundscheck(False) 
> 	def fun()....
>
> But this does not work before "cdef" declared function,
> which I understand.
Ideally, one could fix the parser to support this on cdef functions (and 
just disallow them if they weren't compiler directives).

However you can also write:

with cython.boundscheck(False):
    ...


Dag Sverre


More information about the Cython-dev mailing list