[pypy-svn] r78875 - in pypy/branch/fast-forward/pypy: objspace/std/test rlib

afa at codespeak.net afa at codespeak.net
Mon Nov 8 16:01:39 CET 2010


Author: afa
Date: Mon Nov  8 16:01:37 2010
New Revision: 78875

Modified:
   pypy/branch/fast-forward/pypy/objspace/std/test/test_longobject.py
   pypy/branch/fast-forward/pypy/rlib/rbigint.py
Log:
Crash in test_int.py! Test and fix


Modified: pypy/branch/fast-forward/pypy/objspace/std/test/test_longobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/test/test_longobject.py	(original)
+++ pypy/branch/fast-forward/pypy/objspace/std/test/test_longobject.py	Mon Nov  8 16:01:37 2010
@@ -273,3 +273,4 @@
     def test_bit_length(self):
         assert 8L.bit_length() == 4
         assert (-1<<40).bit_length() == 41
+        assert ((2**31)-1).bit_length() == 31

Modified: pypy/branch/fast-forward/pypy/rlib/rbigint.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/rbigint.py	(original)
+++ pypy/branch/fast-forward/pypy/rlib/rbigint.py	Mon Nov  8 16:01:37 2010
@@ -564,7 +564,7 @@
             return 0
         msd = self.digits[i - 1]
         msd_bits = 0
-        if msd >= 32:
+        while msd >= 32:
             msd_bits += 6
             msd >>= 6
         msd_bits += [



More information about the Pypy-commit mailing list