Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95064:58568f219c61
Date: 2018-08-31 17:35 +0200
http://bitbucket.org/pypy/pypy/changeset/58568f219c61/
Log: do c07dc57b964d differently (output '?' for bad chr)
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,9 +289,6 @@
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)
diff --git a/rpython/rlib/rutf8.py b/rpython/rlib/rutf8.py
--- a/rpython/rlib/rutf8.py
+++ b/rpython/rlib/rutf8.py
@@ -50,6 +50,7 @@
chr((0x80 | ((code >> 12) & 0x3f))) +
chr((0x80 | ((code >> 6) & 0x3f))) +
chr((0x80 | (code & 0x3f))))
+ return '?'
raise ValueError
@try_inline
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit