On Apr 14, 2009, at 11:43 PM, Stefan Behnel wrote:

> Dag Sverre Seljebotn wrote:
>> usually with overflows one just gets the overflowed value
>> silently. With division overflow one crashes the application,  
>> which is
>> IMO much worse even if it is a very rare corner case.
>>
>> I think we should raise OverflowError here under the same  
>> circumstances
>> as ZeroDivisionError.
>
> +1, this matches the patch Lisandro provided.
>
> BTW, isn't there a way to catch these signals in a way that would  
> allow us
> to raise an exception instead? Catching signals isn't the hard part, I
> guess, but we'd have to extract the current state and code position  
> from
> the signal handler, so that we can jump back to the right label and
> continue.
>
> As long as they don't occur, signals are a lot cheaper than doing  
> runtime
> checks all over the place.

Yes, this would be much better. I just am not familiar enough with  
signals to know how to trap them. Also, are there platform  
compatibility issues? (We may be able to use macros which use signals  
when available, and runtime tests if not.)

In any case, I'm going to push a patch to get the behavior right the  
"easy way" for now.

- Robert

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

Reply via email to