[pypy-svn] r50347 - pypy/branch/applevel-ctypes/pypy/module/_ffi/test

fijal at codespeak.net fijal at codespeak.net
Sat Jan 5 11:22:29 CET 2008


Author: fijal
Date: Sat Jan  5 11:22:29 2008
New Revision: 50347

Modified:
   pypy/branch/applevel-ctypes/pypy/module/_ffi/test/test__ffi.py
Log:
Fix the test. The problem is that internal structure is not kept alive. I think
we should do that.


Modified: pypy/branch/applevel-ctypes/pypy/module/_ffi/test/test__ffi.py
==============================================================================
--- pypy/branch/applevel-ctypes/pypy/module/_ffi/test/test__ffi.py	(original)
+++ pypy/branch/applevel-ctypes/pypy/module/_ffi/test/test__ffi.py	Sat Jan  5 11:22:29 2008
@@ -210,13 +210,10 @@
         lib = _ffi.CDLL(self.lib_name)
         inner = lib.ptr("inner_struct_elem", ['P'], 'c')
         X = _ffi.Structure([('x1', 'i'), ('x2', 'h'), ('x3', 'c'), ('next', 'P')])
-        x = X(next=X(next=None, x3='x'), x1=1, x2=2, x3='x')
-        print X(x.next).x3
-        print X(x.next).x3
-        print X(x.next).x3
-        print X(x.next).x3
-        assert X(x.next).x3 == 'x'
+        y = X(next=None, x3='x')
+        x = X(next=y, x1=1, x2=2, x3='x')
         assert inner(x) == 'x'
+        assert X(x.next).x3 == 'x'
         create_double_struct = lib.ptr("create_double_struct", [], 'P')
         x = create_double_struct()
         assert X(X(x).next).x2 == 3


More information about the pypy-svn mailing list