Author: Ronan Lamy <[email protected]>
Branch: unicode-utf8
Changeset: r93379:bdbea29862af
Date: 2017-12-12 02:44 +0000
http://bitbucket.org/pypy/pypy/changeset/bdbea29862af/
Log: Raise ValueError when array item is invalid unicode
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -1030,7 +1030,11 @@
return space.newbytes(item)
elif mytype.typecode == 'u':
code = r_uint(ord(item))
- return space.newutf8(rutf8.unichr_as_utf8(code), 1)
+ try:
+ return space.newutf8(rutf8.unichr_as_utf8(code), 1)
+ except ValueError:
+ raise oefmt(space.w_ValueError,
+ "character is not in range [U+0000; U+10ffff]")
assert 0, "unreachable"
# interface
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit