[pypy-commit] pypy py3.6: win32, python2 doesn't like surrogates, skip this check

mattip pypy.commits at gmail.com
Thu May 30 16:15:26 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r96719:8c02125cb1c5
Date: 2019-05-30 16:51 +0300
http://bitbucket.org/pypy/pypy/changeset/8c02125cb1c5/

Log:	win32, python2 doesn't like surrogates, skip this check

diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -1,5 +1,7 @@
 """The builtin str implementation"""
 
+import sys
+
 from rpython.rlib.objectmodel import (
     compute_hash, compute_unique_id, import_from_mixin, always_inline,
     enforceargs, newlist_hint, specialize, we_are_translated)
@@ -38,7 +40,7 @@
         self._utf8 = utf8str
         self._length = length
         self._index_storage = rutf8.null_storage()
-        if not we_are_translated():
+        if not we_are_translated() and not sys.platform == 'win32':
             # utf8str must always be a valid utf8 string, except maybe with
             # explicit surrogate characters---which .decode('utf-8') doesn't
             # special-case in Python 2, which is exactly what we want here


More information about the pypy-commit mailing list