Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r64642:669925f1265e
Date: 2013-05-28 14:39 -0700
http://bitbucket.org/pypy/pypy/changeset/669925f1265e/

Log:    pass through unicode for %N/%T

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -412,8 +412,15 @@
                     elif fmt in 'NT':
                         if fmt == 'T':
                             value = space.type(value)
-                        # XXX:
-                        result = value.getname(space).decode('utf-8')
+                        try:
+                            w_name = space.getattr(value, 
space.wrap('__name__'))
+                        except OperationError as e:
+                            if not (e.match(space, space.w_TypeError) or
+                                    e.match(space, space.w_AttributeError)):
+                                raise
+                            result = u'?'
+                        else:
+                            result = space.unicode_w(w_name)
                     else:
                         result = unicode(value)
                     lst[i + i + 1] = result
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to