[pypy-commit] pypy operrfmt-NT: utilize %N everywhere

pjenvey noreply at buildbot.pypy.org
Sun May 26 00:35:55 CEST 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: operrfmt-NT
Changeset: r64563:6ee585ed9ea5
Date: 2013-05-25 15:34 -0700
http://bitbucket.org/pypy/pypy/changeset/6ee585ed9ea5/

Log:	utilize %N everywhere

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -225,10 +225,9 @@
     def _exception_getclass(self, space, w_inst):
         w_type = space.exception_getclass(w_inst)
         if not space.exception_is_valid_class_w(w_type):
-            typename = w_type.getname(space)
             msg = ("exceptions must be old-style classes or derived "
-                   "from BaseException, not %s")
-            raise operationerrfmt(space.w_TypeError, msg, typename)
+                   "from BaseException, not %N")
+            raise operationerrfmt(space.w_TypeError, msg, w_type)
         return w_type
 
     def write_unraisable(self, space, where, w_object=None,
diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -69,9 +69,9 @@
     _attrs_ = ()
 
     def descr__new__(space, w_subtype, __args__):
-        raise operationerrfmt(space.w_TypeError, "cannot create '%s' instances",
-            w_subtype.getname(space, '?')
-        )
+        raise operationerrfmt(space.w_TypeError,
+                              "cannot create '%N' instances",
+                              w_subtype)
 
     def get_dtype(self, space):
         return self._get_dtype(space)
diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -669,7 +669,7 @@
 
 def _make_binop_impl(symbol, specialnames):
     left, right = specialnames
-    errormsg = "unsupported operand type(s) for %s: '%%s' and '%%s'" % (
+    errormsg = "unsupported operand type(s) for %s: '%%N' and '%%N'" % (
         symbol.replace('%', '%%'),)
 
     def binop_impl(space, w_obj1, w_obj2):
@@ -710,10 +710,7 @@
         w_res = _invoke_binop(space, w_right_impl, w_obj2, w_obj1)
         if w_res is not None:
             return w_res
-        typename1 = w_typ1.getname(space)
-        typename2 = w_typ2.getname(space)
-        raise operationerrfmt(space.w_TypeError, errormsg,
-                              typename1, typename2)
+        raise operationerrfmt(space.w_TypeError, errormsg, w_typ1, w_typ2)
 
     return func_with_new_name(binop_impl, "binop_%s_impl"%left.strip('_'))
 
diff --git a/pypy/objspace/std/objecttype.py b/pypy/objspace/std/objecttype.py
--- a/pypy/objspace/std/objecttype.py
+++ b/pypy/objspace/std/objecttype.py
@@ -44,8 +44,8 @@
         w_obj.setclass(space, w_newcls)
     else:
         raise operationerrfmt(space.w_TypeError,
-                              "__class__ assignment: '%s' object layout differs from '%s'",
-                              w_oldcls.getname(space), w_newcls.getname(space))
+                              "__class__ assignment: '%N' object layout differs from '%N'",
+                              w_oldcls, w_newcls)
 
 
 app = gateway.applevel("""
diff --git a/pypy/objspace/std/transparent.py b/pypy/objspace/std/transparent.py
--- a/pypy/objspace/std/transparent.py
+++ b/pypy/objspace/std/transparent.py
@@ -58,8 +58,7 @@
         if w_lookup == k:
             return v(space, w_type, w_controller)
     raise operationerrfmt(space.w_TypeError,
-        "'%s' object could not be wrapped",
-        w_type.getname(space))
+                          "'%N' object could not be wrapped", w_type)
 
 def register_proxyable(space, cls):
     tpdef = cls.typedef
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -686,11 +686,9 @@
     newlayout = w_newbestbase.get_full_instance_layout()
 
     if oldlayout != newlayout:
-        raise operationerrfmt(space.w_TypeError,
-                           "__bases__ assignment: '%s' object layout"
-                           " differs from '%s'",
-                           w_newbestbase.getname(space),
-                           w_oldbestbase.getname(space))
+        msg = "__bases__ assignment: '%N' object layout differs from '%N'"
+        raise operationerrfmt(space.w_TypeError, msg,
+                              w_newbestbase, w_oldbestbase)
 
     # invalidate the version_tag of all the current subclasses
     w_type.mutated(None)
@@ -1202,9 +1200,8 @@
     candidate = orderlists[-1][0]
     if candidate in orderlists[-1][1:]:
         # explicit error message for this specific case
-        raise operationerrfmt(space.w_TypeError,
-                              "duplicate base class '%s'",
-                              candidate.getname(space))
+        raise operationerrfmt(space.w_TypeError, "duplicate base class '%N'",
+                              candidate)
     while candidate not in cycle:
         cycle.append(candidate)
         nextblockinglist = mro_blockinglist(candidate, orderlists)


More information about the pypy-commit mailing list