[pypy-svn] r47526 - pypy/dist/pypy/translator/c/test

arigo at codespeak.net arigo at codespeak.net
Thu Oct 18 09:37:26 CEST 2007


Author: arigo
Date: Thu Oct 18 09:37:26 2007
New Revision: 47526

Modified:
   pypy/dist/pypy/translator/c/test/test_newgc.py
Log:
Fix this test: id(x) is unrelated to the address of x in moving GCs.
Use rffi.cast() instead to cast the object pointer to an int directly.


Modified: pypy/dist/pypy/translator/c/test/test_newgc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_newgc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_newgc.py	Thu Oct 18 09:37:26 2007
@@ -780,6 +780,7 @@
     def test_object_alignment(self):
         # all objects returned by the GC should be aligned on a 8-bytes
         # boundary, or whatever sizeof(double) is on this platform
+        from pypy.rpython.lltypesystem import rffi
         mylist = ['a', 'bc', '84139871', 'ajkdh', '876']
         def f():
             result = 0
@@ -787,7 +788,8 @@
             for j in range(100):
                 for s in mylist:
                     buffer += s
-                    result |= id(buffer)
+                    addr = rffi.cast(lltype.Signed, buffer)
+                    result |= addr
             return result
 
         fn = self.getcompiled(f)



More information about the Pypy-commit mailing list