[pypy-svn] r26081 - pypy/dist/pypy/rpython/ootypesystem

antocuni at codespeak.net antocuni at codespeak.net
Fri Apr 21 12:24:07 CEST 2006


Author: antocuni
Date: Fri Apr 21 12:24:03 2006
New Revision: 26081

Modified:
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
Log:
Fixed some functions so that now they handle all subclasses of
BuiltinType, not only List.



Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Fri Apr 21 12:24:03 2006
@@ -297,8 +297,8 @@
     # equal.
 
     def __str__(self):
-        return '%s(%s)' % (self.__class__.__name__,
-                saferecursive(str, "...")(self._KEYTYPE, self._VALUETYPE))
+        return '%s%s' % (self.__class__.__name__,
+                saferecursive(str, "(...)")((self._KEYTYPE, self._VALUETYPE)))
 
     def _get_interp_class(self):
         return _dict
@@ -306,7 +306,7 @@
 
 class ForwardReference(OOType):
     def become(self, real_instance):
-        if not isinstance(real_instance, (Instance, List)):
+        if not isinstance(real_instance, (Instance, BuiltinType)):
             raise TypeError("ForwardReference can only be to an instance, "
                             "not %r" % (real_instance,))
         self.__class__ = real_instance.__class__
@@ -558,7 +558,7 @@
         _callable.__init__(self, METHOD, **attrs)
 
     def _bound(self, DEFINST, inst):
-        assert isinstance(inst, _instance) or isinstance(inst, _list)
+        assert isinstance(inst, _instance) or isinstance(inst, _builtin_type)
         return _bound_meth(DEFINST, inst, self)
 
 class _bound_meth(object):
@@ -634,7 +634,7 @@
     def __init__(self, LIST):
         self.__dict__["_TYPE"] = LIST 
 
-class _dict(object):
+class _dict(_builtin_type):
     def __init__(self, DICT):
         self._TYPE = DICT
         self._dict = {}



More information about the Pypy-commit mailing list