[pypy-commit] pypy unicode-utf8-py3: Fix unicodedata.lookup()
rlamy
pypy.commits at gmail.com
Sat Sep 1 10:34:52 EDT 2018
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95060:cf8669f6fe69
Date: 2018-09-01 16:34 +0200
http://bitbucket.org/pypy/pypy/changeset/cf8669f6fe69/
Log: Fix unicodedata.lookup()
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
@@ -82,9 +82,9 @@
sequence = self._lookup_named_sequence(code)
if sequence is not None:
# named sequences only contain UCS2 codes, no surrogates &co.
- return space.newutf8(unichr_as_utf8(r_uint(code)), 1)
+ return space.newutf8(sequence.encode('utf-8'), len(sequence))
-
+ return space.newutf8(unichr_as_utf8(r_uint(code)), 1)
def name(self, space, w_unichr, w_default=None):
code = unichr_to_code_w(space, w_unichr)
More information about the pypy-commit
mailing list