Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r76411:7926ef4fb172 Date: 2015-03-16 17:21 +0100 http://bitbucket.org/pypy/pypy/changeset/7926ef4fb172/
Log: Fix test to also work in lldebug mode (it used to fail because the C hack to allocate does not track the allocation) diff --git a/rpython/rtyper/lltypesystem/test/test_rffi.py b/rpython/rtyper/lltypesystem/test/test_rffi.py --- a/rpython/rtyper/lltypesystem/test/test_rffi.py +++ b/rpython/rtyper/lltypesystem/test/test_rffi.py @@ -102,24 +102,19 @@ #include <string.h> #include <src/mem.h> - char *f(char* arg) + void f(char *target, char* arg) { - char *ret; - /* 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; + strcpy(target, arg); } """) eci = ExternalCompilationInfo(separate_module_sources=[c_source], - post_include_bits=['char *f(char*);']) - z = llexternal('f', [CCHARP], CCHARP, compilation_info=eci) + post_include_bits=['void f(char*,char*);']) + z = llexternal('f', [CCHARP, CCHARP], lltype.Void, compilation_info=eci) def f(): s = str2charp("xxx") - l_res = z(s) + l_res = lltype.malloc(CCHARP.TO, 10, flavor='raw') + z(l_res, s) res = charp2str(l_res) lltype.free(l_res, flavor='raw') free_charp(s) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit