[pypy-svn] r77636 - in pypy/branch/fast-forward/pypy/interpreter/astcompiler: . test

afa at codespeak.net afa at codespeak.net
Tue Oct 5 23:14:00 CEST 2010


Author: afa
Date: Tue Oct  5 23:13:59 2010
New Revision: 77636

Modified:
   pypy/branch/fast-forward/pypy/interpreter/astcompiler/astbuilder.py
   pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_astbuilder.py
Log:
Properly skip the number prefix: in base 16, don't strip the digit 'b'!


Modified: pypy/branch/fast-forward/pypy/interpreter/astcompiler/astbuilder.py
==============================================================================
--- pypy/branch/fast-forward/pypy/interpreter/astcompiler/astbuilder.py	(original)
+++ pypy/branch/fast-forward/pypy/interpreter/astcompiler/astbuilder.py	Tue Oct  5 23:13:59 2010
@@ -1047,7 +1047,11 @@
             i = 0
             limit = len(raw) - 1
             while i < limit:
-                if raw[i] not in "0xXoOBb":
+                if base == 16 and raw[i] not in "0xX":
+                    break
+                if base == 8 and raw[i] not in "0oO":
+                    break
+                if base == 2 and raw[i] not in "0bB":
                     break
                 i += 1
             raw = raw[i:]

Modified: pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_astbuilder.py
==============================================================================
--- pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_astbuilder.py	(original)
+++ pypy/branch/fast-forward/pypy/interpreter/astcompiler/test/test_astbuilder.py	Tue Oct  5 23:13:59 2010
@@ -1129,6 +1129,7 @@
         assert space.eq_w(get_num("00053"), space.wrap(053))
         for num in ("0x53", "0X53", "0x0000053", "0X00053"):
             assert space.eq_w(get_num(num), space.wrap(0x53))
+        assert space.eq_w(get_num("0Xb0d2"), space.wrap(0xb0d2))
         assert space.eq_w(get_num("0X53"), space.wrap(0x53))
         assert space.eq_w(get_num("0"), space.wrap(0))
         assert space.eq_w(get_num("00000"), space.wrap(0))



More information about the Pypy-commit mailing list