Commits

Philip Jenvey  committed 6ee585e

utilize %N everywhere

  • Participants
  • Parent commits 681043e
  • Branches operrfmt-NT

Comments (0)

Files changed (6)

File pypy/interpreter/error.py

     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,

File pypy/module/micronumpy/interp_boxes.py

     _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)

File pypy/objspace/descroperation.py

 
 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):
         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('_'))
 

File pypy/objspace/std/objecttype.py

         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("""

File pypy/objspace/std/transparent.py

         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

File pypy/objspace/std/typeobject.py

     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)
     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)