[pypy-svn] r12178 - pypy/dist/pypy/rpython
tismer at codespeak.net
tismer at codespeak.net
Wed May 11 16:11:10 CEST 2005
Author: tismer
Date: Wed May 11 16:11:10 2005
New Revision: 12178
Modified:
pypy/dist/pypy/rpython/rarithmetic.py
Log:
made a local copy of ovfcheck, to be called
by ovfcheck_lshift.
Reason: I case that we don't annotate, this
function call would become a syntax error in transform_ovfcheck
Modified: pypy/dist/pypy/rpython/rarithmetic.py
==============================================================================
--- pypy/dist/pypy/rpython/rarithmetic.py (original)
+++ pypy/dist/pypy/rpython/rarithmetic.py Wed May 11 16:11:10 2005
@@ -177,8 +177,16 @@
raise OverflowError, "signed integer expression did overflow"
return r
+def _local_ovfcheck(r):
+ # a copy of the above, because we cannot call ovfcheck
+ # in a context where no primitiveoperator is involved.
+ assert not isinstance(r, r_uint), "unexpected ovf check on unsigned"
+ if isinstance(r, long):
+ raise OverflowError, "signed integer expression did overflow"
+ return r
+
def ovfcheck_lshift(a, b):
- return ovfcheck(int(long(a) << b))
+ return _local_ovfcheck(int(long(a) << b))
class r_uint(long):
""" fake unsigned integer implementation """
More information about the Pypy-commit
mailing list