On 09/08/15 11:54, Armin Rigo wrote:
Hi Matti,

Replying to commit "614e585": "do not raise exceptions in __init__"

The __init__ can raise exceptions, it's not the problem here.  This
commit changes (only) something else: it moves around which "*" turn
into an overflow-checking multiplication, and which ones don't.  The
"*" operation in RPython, like the other common arithmetic operations,
turn by default into C code as a "*" that assumes that overflow does
not occur (and the C compiler sometimes optimizes based on this).  On
the other hand, if the "*" operation in RPython appears immediately
inside a "try: except OverflowError:" (and only in this case), then in
C it will also do the same check.

Notably, this checkin fixes this code (by removing it):

        try:
             length = support.product(shape)
        except OverflowError as e:
             ...

which after translation to C would never catch an OverflowError
occurring implicitly inside product().


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev
Sorry, I'm still confused.
In the product() function there is ovfcheck(i*x).
Are you saying that the ovfcheck will only raise an exception if it is immediately surrounded with a try: except OverflowError clause, and not raise an exception if the clause wraps the product(shape) function call (as written in the snippet above)? If this is the case then the ovfcheck as written in product() is useless and must be fixed?
Matti
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to