[pypy-svn] r47187 - in pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem: . test

arigo at codespeak.net arigo at codespeak.net
Fri Oct 5 15:17:10 CEST 2007


Author: arigo
Date: Fri Oct  5 15:17:08 2007
New Revision: 47187

Modified:
   pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/llmemory.py
   pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/test/test_llmemory.py
Log:
A fix in the test, and another fix in the source.


Modified: pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/llmemory.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/llmemory.py	(original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/llmemory.py	Fri Oct  5 15:17:08 2007
@@ -195,7 +195,9 @@
     def ref(self, arrayptr):
         assert lltype.typeOf(arrayptr).TO == self.TYPE
         if isinstance(self.TYPE.OF, lltype.ContainerType):
-            return arrayptr[0]
+            # XXX this doesn't support empty arrays
+            o = arrayptr._obj.getitem(0)
+            return o._as_ptr()
         else:
             return lltype.direct_arrayitems(arrayptr)
 

Modified: pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/test/test_llmemory.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/test/test_llmemory.py	(original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/lltypesystem/test/test_llmemory.py	Fri Oct  5 15:17:08 2007
@@ -98,7 +98,8 @@
     for a in [lltype.malloc(lltype.GcArray(S), 5),
               lltype.malloc(lltype.FixedSizeArray(S, 5), immortal=True)]:
         a[3].x = 42
-        adr_s = cast_ptr_to_adr(a[0])
+        adr_s = cast_ptr_to_adr(a)
+        adr_s += itemoffsetof(lltype.typeOf(a).TO, 0)
         adr_s += sizeof(S) * 3
         s = cast_adr_to_ptr(adr_s, lltype.Ptr(S))
         assert s.x == 42



More information about the Pypy-commit mailing list