[pypy-svn] r26524 - pypy/dist/pypy/rpython/rctypes/test

ac at codespeak.net ac at codespeak.net
Fri Apr 28 17:10:45 CEST 2006


Author: ac
Date: Fri Apr 28 17:10:44 2006
New Revision: 26524

Modified:
   pypy/dist/pypy/rpython/rctypes/test/test_rstruct.py
Log:
(aleale, arre) Structures with pointer to them selves do *not* work

Modified: pypy/dist/pypy/rpython/rctypes/test/test_rstruct.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/test/test_rstruct.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/test/test_rstruct.py	Fri Apr 28 17:10:44 2006
@@ -13,7 +13,7 @@
 from pypy.rpython.test.test_llinterp import interpret
 
 from ctypes import c_int, c_short, Structure, POINTER, pointer, c_char_p
-from ctypes import c_char
+from ctypes import c_char, SetPointerType
 
 class tagpoint(Structure):
     _fields_ = [("x", c_int),
@@ -151,6 +151,23 @@
         res = interpret(func, [])
         assert res == 121
 
+    def test_struct_with_pointer_to_self(self):
+        py.test.skip('In-preogress')
+        PS = POINTER('S')
+        class S(Structure):
+            _fields_ = [('l', PS), ('r', PS)]
+        SetPointerType(PS, S)
+
+        def func():
+            s0 = S()
+            s0.r = s0
+            s0.l = pointer(S())
+            s0.l.r = s0
+
+            return bool(s0.r.contents.l.contents.r)
+        res = interpret(func, [])
+        assert res is False
+        
     def test_specialize_keepalive(self):
         class S(Structure):
             _fields_ = [('x', c_int)]



More information about the Pypy-commit mailing list