[pypy-commit] pypy win64-stage1: simple but ugly hack to make 'test_mod_ovf_zer' pass.

ctismer noreply at buildbot.pypy.org
Mon Nov 28 16:27:39 CET 2011


Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r49916:dc399690828c
Date: 2011-11-28 16:27 +0100
http://bitbucket.org/pypy/pypy/changeset/dc399690828c/

Log:	simple but ugly hack to make 'test_mod_ovf_zer' pass. ovfcheck(x %
	y) does not help when int and long are unified. So we check on (x //
	y) but use (x % y)

diff --git a/pypy/rpython/llinterp.py b/pypy/rpython/llinterp.py
--- a/pypy/rpython/llinterp.py
+++ b/pypy/rpython/llinterp.py
@@ -1057,7 +1057,9 @@
                 return r
                 '''%locals()
         elif operator == '%':
-            code = '''r = %(checkfn)s(x %% y)
+            ## overflow check on % does not work with emulated int
+            code = '''%(checkfn)s(x // y)
+                r = x %% y
                 if x^y < 0 and x%%y != 0:
                     r -= y
                 return r


More information about the pypy-commit mailing list