Author: Ronan Lamy <[email protected]>
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)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to