[Cython] C int division by zero
Stefan Behnel
stefan_ml at behnel.de
Wed Apr 15 08:35:12 CEST 2009
Robert Bradshaw wrote:
>>> On Apr 14, 2009, at 9:17 AM, Dag Sverre Seljebotn wrote:
>>>
>>>> I was just thinking about this:
>>>>
>>>> cdef int a = 10, b = 0
>>>> print a // b
>>>>
>>>> which currently gives a C exception terminating the Python
>>>> interpreter.
>>>
>>> Since we changed it, we should chang it all the way. It will be
>>> somewhat uglier as this means when writing a / (c-c) one needs to
>>> store the denominator in a temp and check it rather than simply
>>> letting the expression through to C (I already did this for
>>> warnings).
>
> OK, pushed. http://hg.cython.org/cython-devel/rev/a09a309febdc
Note that this requires a GIL check now (just like the warning case),
haven't checked if this case is currently handled.
Stefan
More information about the Cython-dev
mailing list