[pypy-svn] r11723 - in pypy/dist/pypy/objspace/std: . test

pedronis at codespeak.net pedronis at codespeak.net
Sun May 1 20:24:51 CEST 2005


Author: pedronis
Date: Sun May  1 20:24:51 2005
New Revision: 11723

Modified:
   pypy/dist/pypy/objspace/std/test/test_typeobject.py
   pypy/dist/pypy/objspace/std/typeobject.py
Log:
if a type live in __builtin__ then always use type (not class) in its repr



Modified: pypy/dist/pypy/objspace/std/test/test_typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_typeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_typeobject.py	Sun May  1 20:24:51 2005
@@ -278,6 +278,8 @@
             pass
         assert repr(A) == "<class 'a.A'>"
         assert repr(type(type)) == "<type 'type'>" 
+        assert repr(complex) == "<type 'complex'>"
+        assert repr(property) == "<type 'property'>"
         
     def test_invalid_mro(self):
         class A(object):

Modified: pypy/dist/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/typeobject.py	Sun May  1 20:24:51 2005
@@ -253,10 +253,10 @@
         mod = None
     else:
         mod = space.str_w(w_mod)
-    if w_obj.is_heaptype():
-        kind = 'class'
-    else:
+    if not w_obj.is_heaptype() or (mod is not None and mod == '__builtin__'):
         kind = 'type'
+    else:
+        kind = 'class'
     if mod is not None and mod !='__builtin__':
         return space.wrap("<%s '%s.%s'>" % (kind, mod, w_obj.name))
     else:



More information about the Pypy-commit mailing list