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

Reply via email to