Author: Matti Picus <matti.pi...@gmail.com> Branch: unicode-utf8-py3 Changeset: r95048:c07dc57b964d Date: 2018-08-31 09:04 +0200 http://bitbucket.org/pypy/pypy/changeset/c07dc57b964d/
Log: revert 6105ef49d9ca, try to catch error diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py --- a/pypy/module/_codecs/interp_codecs.py +++ b/pypy/module/_codecs/interp_codecs.py @@ -832,7 +832,7 @@ # Charmap may return a number x = space.int_w(w_ch) if not 0 <= x <= 0x10FFFF: - raise oefmt(space.w_ValueError, + raise oefmt(space.w_TypeError, "character mapping must be in range(0x110000)") return rutf8.unichr_as_utf8(x) elif space.is_w(w_ch, space.w_None): diff --git a/pypy/module/unicodedata/interp_ucd.py b/pypy/module/unicodedata/interp_ucd.py --- a/pypy/module/unicodedata/interp_ucd.py +++ b/pypy/module/unicodedata/interp_ucd.py @@ -289,6 +289,9 @@ def build(self, space, r, stop): builder = Utf8StringBuilder(stop * 3) for i in range(stop): + code = r_uint(r[i]) + if code > r_uint(0x10FFFF): + raise oefmt(space.w_ValueError, "code > 0x10FFFF") builder.append_code(r[i]) return space.newutf8(builder.build(), stop) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit