[pypy-svn] r29593 - in pypy/dist/pypy/rpython/lltypesystem: . module

arigo at codespeak.net arigo at codespeak.net
Sun Jul 2 17:06:04 CEST 2006


Author: arigo
Date: Sun Jul  2 17:06:03 2006
New Revision: 29593

Modified:
   pypy/dist/pypy/rpython/lltypesystem/module/ll_os.py
   pypy/dist/pypy/rpython/lltypesystem/rtuple.py
Log:
Fix breakage from previous check-in.


Modified: pypy/dist/pypy/rpython/lltypesystem/module/ll_os.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/module/ll_os.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/module/ll_os.py	Sun Jul  2 17:06:03 2006
@@ -1,13 +1,10 @@
 from pypy.rpython.module.support import LLSupport
 from pypy.rpython.module.ll_os import BaseOS
-from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.lltypesystem import lltype, rtuple
 from pypy.rpython.rarithmetic import intmask
 
 n = 10
-fieldnames = ['item%d' % i for i in range(n)]
-lltypes = [lltype.Signed]*n
-fields = tuple(zip(fieldnames, lltypes))    
-STAT_RESULT = lltype.GcStruct('tuple%d' % n, *fields)
+STAT_RESULT = rtuple.TUPLE_TYPE([lltype.Signed]*n).TO
 
 class Implementation(BaseOS, LLSupport):
     

Modified: pypy/dist/pypy/rpython/lltypesystem/rtuple.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rtuple.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rtuple.py	Sun Jul  2 17:06:03 2006
@@ -16,18 +16,19 @@
 #        ...
 #    }
 
+def TUPLE_TYPE(field_lltypes):
+    if len(field_lltypes) == 0:
+        return Void      # empty tuple
+    else:
+        fields = [('item%d' % i, TYPE) for i, TYPE in enumerate(field_lltypes)]
+        kwds = {'hints': {'immutable': True}}
+        return Ptr(GcStruct('tuple%d' % len(field_lltypes), *fields, **kwds))
+
 class TupleRepr(AbstractTupleRepr):
 
     def __init__(self, rtyper, items_r):
         AbstractTupleRepr.__init__(self, rtyper, items_r)
-        if len(items_r) == 0:
-            self.lowleveltype = Void     # empty tuple
-        else:
-            fields = zip(self.fieldnames, self.lltypes)
-            kwds = {'hints': {'immutable': True}}
-            self.lowleveltype = Ptr(GcStruct('tuple%d' % len(self.items_r),
-                                             *fields,
-                                             **kwds))
+        self.lowleveltype = TUPLE_TYPE(self.lltypes)
 
     def newtuple(cls, llops, r_tuple, items_v):
         # items_v should have the lowleveltype of the internal reprs



More information about the Pypy-commit mailing list