[pypy-commit] pypy unicode-utf8-py3: fix d7b217949b58

mattip pypy.commits at gmail.com
Sat Aug 4 18:01:36 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r94941:fe6bd08c8ad1
Date: 2018-08-04 14:55 -0700
http://bitbucket.org/pypy/pypy/changeset/fe6bd08c8ad1/

Log:	fix d7b217949b58

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -517,10 +517,10 @@
                     elif fmt == 'N':
                         result = value.getname(space)
                     elif fmt == '8':
-                        try:
-                            result = value.decode('utf8')
-                        except UnicodeDecodeError:
-                            result = value.decode('unicode-escape')
+                        if isinstance(value, unicode):
+                            result = value.encode('utf8')
+                        else:
+                            result = value
                     else:
                         if isinstance(value, unicode):
                             result = value


More information about the pypy-commit mailing list