Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r56514:921f8d1d3ffa
Date: 2012-07-31 18:14 +0200
http://bitbucket.org/pypy/pypy/changeset/921f8d1d3ffa/

Log:    Workaround to make test_repr_16bits pass, from
        test_unicodeobject.py, on top of a 16-bit hosting CPython. Running
        py.py or py.test on top of a 16-bit-wide hosting CPython is still
        not perfect and will probably never be.

diff --git a/pypy/rlib/runicode.py b/pypy/rlib/runicode.py
--- a/pypy/rlib/runicode.py
+++ b/pypy/rlib/runicode.py
@@ -1235,7 +1235,11 @@
             pos += 1
             continue
 
-        if MAXUNICODE < 65536 and 0xD800 <= oc < 0xDC00 and pos + 1 < size:
+        # The following logic is enabled only if MAXUNICODE == 0xffff, or
+        # for testing on top of a host CPython where sys.maxunicode == 0xffff
+        if ((MAXUNICODE < 65536 or
+                (not we_are_translated() and sys.maxunicode < 65536))
+            and 0xD800 <= oc < 0xDC00 and pos + 1 < size):
             # Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes
             pos += 1
             oc2 = ord(s[pos])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to