[pypy-svn] pypy fast-forward: Oops, I did it completely backwards.

amauryfa commits-noreply at bitbucket.org
Fri Jan 7 11:41:05 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40443:a44029792b52
Date: 2011-01-07 11:40 +0100
http://bitbucket.org/pypy/pypy/changeset/a44029792b52/

Log:	Oops, I did it completely backwards. exceptions were oddly formatted
	in py.py and AppTests.

diff --git a/pypy/interpreter/astcompiler/astbuilder.py b/pypy/interpreter/astcompiler/astbuilder.py
--- a/pypy/interpreter/astcompiler/astbuilder.py
+++ b/pypy/interpreter/astcompiler/astbuilder.py
@@ -1095,7 +1095,7 @@
                 if not e.match(space, space.w_UnicodeError):
                     raise
                 # UnicodeError in literal: turn into SyntaxError
-                self.error(e.errorstr(space, use_str=True), atom_node)
+                self.error(e.errorstr(space), atom_node)
                 sub_strings_w = [] # please annotator
             # This implements implicit string concatenation.
             if len(sub_strings_w) > 1:

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -56,7 +56,7 @@
             s = self._compute_value()
         return '[%s: %s]' % (self.w_type, s)
 
-    def errorstr(self, space, use_str=False):
+    def errorstr(self, space, use_repr=False):
         "The exception class and value, as a string."
         w_value = self.get_w_value(space)
         if space is None:
@@ -74,10 +74,10 @@
                 exc_value = ""
             else:
                 try:
-                    if use_str:
+                    if use_repr:
+                        exc_value = space.str_w(space.repr(w_value))
+                    else:
                         exc_value = space.str_w(space.str(w_value))
-                    else:
-                        exc_value = space.str_w(space.repr(w_value))
                 except OperationError:
                     # oups, cannot __str__ the exception object
                     exc_value = "<oups, exception object itself cannot be str'd>"
@@ -234,7 +234,7 @@
             except OperationError:
                 objrepr = '?'
         msg = 'Exception %s in %s%s ignored\n' % (
-            self.errorstr(space, use_str=True), where, objrepr)
+            self.errorstr(space, use_repr=True), where, objrepr)
         try:
             space.call_method(space.sys.get('stderr'), 'write', space.wrap(msg))
         except OperationError:


More information about the Pypy-commit mailing list