[pypy-svn] r47043 - pypy/dist/pypy/rpython/lltypesystem/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Sep 30 18:16:55 CEST 2007


Author: cfbolz
Date: Sun Sep 30 18:16:53 2007
New Revision: 47043

Modified:
   pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
failing test: an external function allocates something and returns it. 
When freeing this after conversion back to an lltype structure there is a 
failing assertion.


Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py	Sun Sep 30 18:16:53 2007
@@ -648,3 +648,20 @@
         assert abs(float(b[1]) - 1.1) < 1E-6
         assert isinstance(b[2], rffi.r_singlefloat)
         assert abs(float(b[2]) - 2.2) < 1E-6
+
+    def test_cfunc_returning_newly_allocated(self):
+        py.test.skip("complains about a double free")
+        from crypt import crypt as pycrypt
+        crypt = rffi.llexternal('crypt', [rffi.CCHARP, rffi.CCHARP],
+                                rffi.CCHARP,
+                                libraries=['crypt'])
+
+        s1 = rffi.str2charp("pass")
+        s2 = rffi.str2charp("ab")
+        r = crypt(s1, s2)
+        rffi.free_charp(s1)
+        rffi.free_charp(s2)
+        res = rffi.charp2str(r)
+        assert res == pycrypt("pass", "ab")
+        rffi.free_charp(r)
+        assert not ALLOCATED



More information about the Pypy-commit mailing list