[pypy-svn] r18977 - pypy/dist/pypy/rpython/lltypesystem

pedronis at codespeak.net pedronis at codespeak.net
Wed Oct 26 01:49:21 CEST 2005


Author: pedronis
Date: Wed Oct 26 01:49:20 2005
New Revision: 18977

Modified:
   pypy/dist/pypy/rpython/lltypesystem/lltype.py
Log:
make __str__ and related more robust against recursive cases for Arrays and Functions



Modified: pypy/dist/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lltype.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/lltype.py	Wed Oct 26 01:49:20 2005
@@ -299,7 +299,8 @@
             else:
                 return "%s { %s }" % (of._name, of._str_fields())
         else:
-            return self.OF
+            return str(self.OF)
+    _str_fields = saferecursive(_str_fields, '...')
 
     def __str__(self):
         return "%s of %s " % (self.__class__.__name__,
@@ -308,6 +309,7 @@
     def _short_name(self):
         return "%s %s" % (self.__class__.__name__,
                           self.OF._short_name(),)
+    _short_name = saferecursive(_short_name, '...')
 
     def _container_example(self):
         return _array(self, 1)
@@ -332,11 +334,13 @@
     def __str__(self):
         args = ', '.join(map(str, self.ARGS))
         return "Func ( %s ) -> %s" % (args, self.RESULT)
+    __str__ = saferecursive(__str__, '...')
 
     def _short_name(self):        
         args = ', '.join([ARG._short_name() for ARG in self.ARGS])
-        return "Func(%s)->%s" % (args, self.RESULT._short_name)        
-        
+        return "Func(%s)->%s" % (args, self.RESULT._short_name())        
+    _short_name = saferecursive(_short_name, '...')
+
     def _container_example(self):
         def ex(*args):
             return self.RESULT._defl()



More information about the Pypy-commit mailing list