Commits

Brian Kearns committed 1a89979

additional fixes

Comments (0)

Files changed (3)

pypy/module/_io/interp_bufferedio.py

         return space.call_method(self.w_raw, "isatty")
 
     def repr_w(self, space):
-        typename = space.type(self).getname(space)
-        module = space.str_w(space.type(self).get_module())
+        typename = space.type(self).name
         try:
             w_name = space.getattr(self, space.wrap("name"))
         except OperationError, e:
             if not e.match(space, space.w_AttributeError):
                 raise
-            return space.wrap("<%s.%s>" % (module, typename,))
+            return space.wrap("<%s>" % (typename,))
         else:
             name_repr = space.str_w(space.repr(w_name))
-            return space.wrap("<%s.%s name=%s>" % (module, typename, name_repr))
+            return space.wrap("<%s name=%s>" % (typename, name_repr))
 
     # ______________________________________________
 

pypy/objspace/std/test/test_typeobject.py

         class A(object):
             pass
         assert repr(A) == "<class 'a.A'>"
-        assert repr(type(type)) == "<type 'type'>" 
+        A.__module__ = 123
+        assert repr(A) == "<class 'A'>"
+        assert repr(type(type)) == "<type 'type'>"
         assert repr(complex) == "<type 'complex'>"
         assert repr(property) == "<type 'property'>"
         assert repr(TypeError) == "<type 'exceptions.TypeError'>"

pypy/objspace/std/typeobject.py

 
 def repr__Type(space, w_obj):
     w_mod = w_obj.get_module()
-    if not space.isinstance_w(w_mod, space.w_str):
+    if w_mod is None or not space.isinstance_w(w_mod, space.w_str):
         mod = None
     else:
         mod = space.str_w(w_mod)