Hello,

I was learning Cython from this tutorial when I noticed a glitch:

Near the end, after boundscheck False, some variables are changed to 
unsigned int.  But this has unexpected consequences: variables t_from and such
are not determined correctly, as one of the arguments is negative, but gets
cast to unsigned for comaprison.  (Yes, this is a weird feature of C.)

Actually, the use of unsigned does not seem to have any impact on performance,
so I suggest to scratch that part of tutorial.  Just explain that with 
boundscheck
off, negaitive indices no longer work.

(But there might perhaps be one small improvent in cython itself: with 
boundscheck
off, the index might be cast to unsigned before it is used:  this way we 
probably
crash on negative values, instead of silently accessing the negative offset of 
the array data.)

Thank you for nice piece of software,
        Stepan Kasal

_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to