[pypy-commit] pypy default: backout d492bd661190: this breaks a couple rpython tests
pjenvey
noreply at buildbot.pypy.org
Thu May 8 20:04:56 CEST 2014
Author: Philip Jenvey <pjenvey at underboss.org>
Branch:
Changeset: r71415:d4a4d951ddc2
Date: 2014-05-08 11:04 -0700
http://bitbucket.org/pypy/pypy/changeset/d4a4d951ddc2/
Log: backout d492bd661190: this breaks a couple rpython tests
diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -331,8 +331,7 @@
ch2 = ord(s[pos])
# Check for low surrogate and combine the two to
# form a UCS4 value
- if ((allow_surrogates or MAXUNICODE < 65536) and
- ch <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF):
+ if ch <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF:
ch3 = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000
pos += 1
_encodeUCS4(result, ch3)
diff --git a/rpython/rlib/test/test_runicode.py b/rpython/rlib/test/test_runicode.py
--- a/rpython/rlib/test/test_runicode.py
+++ b/rpython/rlib/test/test_runicode.py
@@ -803,20 +803,3 @@
u, len(u), True) == r'\ud800\udc00'
assert runicode.unicode_encode_raw_unicode_escape(
u, len(u), True) == r'\ud800\udc00'
-
- def test_encode_surrogate_pair_utf8(self):
- u = runicode.UNICHR(0xD800) + runicode.UNICHR(0xDC00)
- if runicode.MAXUNICODE < 65536:
- # Narrow unicode build, consider utf16 surrogate pairs
- assert runicode.unicode_encode_utf_8(
- u, len(u), True, allow_surrogates=True) == '\xf0\x90\x80\x80'
- assert runicode.unicode_encode_utf_8(
- u, len(u), True, allow_surrogates=False) == '\xf0\x90\x80\x80'
- else:
- # Wide unicode build, merge utf16 surrogate pairs only when allowed
- assert runicode.unicode_encode_utf_8(
- u, len(u), True, allow_surrogates=True) == '\xf0\x90\x80\x80'
- # Surrogates not merged, encoding fails.
- py.test.raises(
- UnicodeEncodeError, runicode.unicode_encode_utf_8,
- u, len(u), True, allow_surrogates=False)
More information about the pypy-commit
mailing list