[pypy-svn] r61556 - pypy/trunk/pypy/rpython/lltypesystem/test

afa at codespeak.net afa at codespeak.net
Thu Feb 5 12:51:43 CET 2009


Author: afa
Date: Thu Feb  5 12:51:41 2009
New Revision: 61556

Modified:
   pypy/trunk/pypy/rpython/lltypesystem/test/test_rffi.py
Log:
Fix the test by replacing the plain malloc() call with OP_RAW_MALLOC.


Modified: pypy/trunk/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/test/test_rffi.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/test/test_rffi.py	Thu Feb  5 12:51:41 2009
@@ -71,19 +71,18 @@
         assert xf() == 3
     
     def test_string_reverse(self):
-        # XXX This test crashes with a debug build
-        # (when python is built WITH_PYMALLOC and PYMALLOC_DEBUG):
-        # lltype.free calls OP_RAW_FREE() == PyObject_Free(),
-        # but the buffer comes from a malloc()
-        if sys.platform == 'win32' and 'python_d' in sys.executable:
-            py.test.skip("Crash with a debug build")
         c_source = py.code.Source("""
         #include <string.h>
+        #include <Python.h>
+        #include <src/mem.h>
     
         char *f(char* arg)
         {
             char *ret;
-            ret = (char*)malloc(strlen(arg) + 1);
+            /* lltype.free uses OP_RAW_FREE, we must allocate
+             * with the matching function
+             */
+            OP_RAW_MALLOC(strlen(arg) + 1, ret, char*)
             strcpy(ret, arg);
             return ret;
         }



More information about the Pypy-commit mailing list