Author: mattip <matti.pi...@gmail.com> Branch: win32-cleanup3 Changeset: r60431:ae93f80293b8 Date: 2013-01-24 22:54 +0200 http://bitbucket.org/pypy/pypy/changeset/ae93f80293b8/
Log: revert changeset 727405791c06 to pass tests on narrow builds diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -43,8 +43,30 @@ ORD._flowspace_rewrite_directly_as_ = ord else: - UNICHR = unichr - ORD = ord + #UNICHR = unichr + #ORD = ord + def UNICHR(c): + if c <= sys.maxunicode and c <= MAXUNICODE: + return unichr(c) + else: + c -= 0x10000 + return (unichr(0xD800 + (c >> 10)) + + unichr(0xDC00 + (c & 0x03FF))) + + def ORD(u): + assert isinstance(u, unicode) + if len(u) == 1: + return ord(u[0]) + elif len(u) == 2: + ch1 = ord(u[0]) + ch2 = ord(u[1]) + if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: + return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x10000 + raise ValueError + +def _STORECHAR(result, CH, byteorder): + hi = chr(((CH) >> 8) & 0xff) + lo = chr((CH) & 0xff) if MAXUNICODE > 0xFFFF: def code_to_unichr(code): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit