[pypy-commit] pypy unicode-utf8-py3: revert rpython changes, we should not use runicode

mattip pypy.commits at gmail.com
Sat Aug 4 19:45:43 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r94943:01c64e911294
Date: 2018-08-04 16:42 -0700
http://bitbucket.org/pypy/pypy/changeset/01c64e911294/

Log:	revert rpython changes, we should not use runicode

diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -707,7 +707,7 @@
             address.unlock()
             errno = _c.geterrno()
             timeout = self.timeout
-            if (timeout > 0.0 and res < 0 and 
+            if (timeout > 0.0 and res < 0 and
                 errno in (_c.EWOULDBLOCK, _c.WSAEWOULDBLOCK)):
                 tv = rffi.make(_c.timeval)
                 rffi.setintfield(tv, 'c_tv_sec', int(timeout))
diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -1401,7 +1401,7 @@
             endinpos += 1
         res, pos = errorhandler(errors, encoding,
                                 message, s, pos-2, endinpos)
-        builder.append(res.decode('utf8'))
+        builder.append(res)
     else:
         try:
             chr = r_uint(int(s[pos:pos+digits], 16))
@@ -1411,7 +1411,7 @@
                 endinpos += 1
             res, pos = errorhandler(errors, encoding,
                                     message, s, pos-2, endinpos)
-            builder.append(res.decode('utf8'))
+            builder.append(res)
         else:
             # when we get here, chr is a 32-bit unicode character
             if chr <= MAXUNICODE:
@@ -1427,7 +1427,7 @@
                 message = "illegal Unicode character"
                 res, pos = errorhandler(errors, encoding,
                                         message, s, pos-2, pos+digits)
-                builder.append(res.decode('utf8'))
+                builder.append(res)
     return pos
 
 def str_decode_unicode_escape(s, size, errors, final=False,
@@ -1708,12 +1708,8 @@
             pos += 1
             continue
 
-        if s[pos] == 'u':
-            digits = 4
-            message = "truncated \\uXXXX escape"
-        else:
-            digits = 8
-            message = "truncated \\UXXXXXXXX escape"
+        digits = 4 if s[pos] == 'u' else 8
+        message = "truncated \\uXXXX"
         pos += 1
         pos = hexescape(result, s, pos, digits,
                         "rawunicodeescape", errorhandler, message, errors)


More information about the pypy-commit mailing list