Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r89782:9eb7c2912413
Date: 2017-01-26 10:13 +0100
http://bitbucket.org/pypy/pypy/changeset/9eb7c2912413/

Log:    Fix

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -71,7 +71,8 @@
 
     def errorstr(self, space, use_repr=False):
         "The exception class and value, as a string."
-        self.normalize_exception(space)
+        if not use_repr:    # see write_unraisable()
+            self.normalize_exception(space)
         w_value = self.get_w_value(space)
         if space is None:
             # this part NOT_RPYTHON
@@ -262,6 +263,11 @@
                     traceback.print_exception(t, v, tb)
                 """)
             else:
+                # Note that like CPython, we don't normalize the
+                # exception here.  So from `'foo'.index('bar')` you get
+                # "Exception ValueError: 'substring not found' in x ignored"
+                # but from `raise ValueError('foo')` you get
+                # "Exception ValueError: ValueError('foo',) in x ignored"
                 msg = 'Exception %s in %s%s ignored\n' % (
                     self.errorstr(space, use_repr=True), where, objrepr)
                 space.call_method(space.sys.get('stderr'), 'write',
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to