Author: Matti Picus <[email protected]>
Branch: py3.6
Changeset: r96610:c0cb46236cc7
Date: 2019-05-13 14:01 -0700
http://bitbucket.org/pypy/pypy/changeset/c0cb46236cc7/

Log:    merge fix-literal-prev_digit-underscore which fixes converting
        strings with '_' to ints

diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst
--- a/pypy/doc/whatsnew-pypy3-head.rst
+++ b/pypy/doc/whatsnew-pypy3-head.rst
@@ -2,14 +2,9 @@
 What's new in PyPy3 7.1+
 ========================
 
-.. this is the revision after release-pypy3.6-v7.1
-.. startrev: d642a3c217cb
+.. this is the revision after release-pypy3.6-v7.1.1
+.. startrev: db5a1e7fbbd0
 
-.. branch: zlib-make-py3-go-boom
+.. branch: fix-literal-prev_digit-underscore
 
-Complain if you try to copy a flushed zlib decompress on py3
-
-.. branch: winoverlapped
-
-Add support for async (overlapped) IO on Windows.
-
+Fix parsing for converting strings with underscore into ints
diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py 
b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -126,6 +126,9 @@
         for c in expressions.constants:
             yield (self.simple_test, "x="+c, "x", eval(c))
 
+    def test_const_underscore(self):
+        yield (self.simple_test, "x=0xffff_ffff_ff20_0000", "x", 
0xffffffffff200000)
+
     def test_neg_sys_maxint(self):
         import sys
         stmt = "x = %s" % (-sys.maxint-1)
diff --git a/rpython/rlib/rstring.py b/rpython/rlib/rstring.py
--- a/rpython/rlib/rstring.py
+++ b/rpython/rlib/rstring.py
@@ -579,6 +579,11 @@
         assert i >= 0
         self.i = i
         c = self.s[i]
+        if self.allow_underscores and c == '_':
+            i = self.i - 1
+            assert i >= 0
+            self.i = i
+            c = self.s[i]
         digit = ord(c)
         if '0' <= c <= '9':
             digit -= ord('0')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to