Author: Wim Lavrijsen <[email protected]>
Branch: cling-support
Changeset: r86236:4333bf213e97
Date: 2016-08-16 16:41 -0700
http://bitbucket.org/pypy/pypy/changeset/4333bf213e97/

Log:    cleanup

diff --git a/pypy/module/cppyy/capi/cling_capi.py 
b/pypy/module/cppyy/capi/cling_capi.py
--- a/pypy/module/cppyy/capi/cling_capi.py
+++ b/pypy/module/cppyy/capi/cling_capi.py
@@ -1,6 +1,6 @@
 import py, os
 
-from pypy.interpreter.gateway import interp2app, unwrap_spec
+from pypy.interpreter.gateway import interp2app
 
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.rtyper.lltypesystem import rffi, lltype
diff --git a/pypy/module/cppyy/capi/loadable_capi.py 
b/pypy/module/cppyy/capi/loadable_capi.py
--- a/pypy/module/cppyy/capi/loadable_capi.py
+++ b/pypy/module/cppyy/capi/loadable_capi.py
@@ -3,6 +3,7 @@
 from rpython.rlib.rarithmetic import r_singlefloat
 from rpython.tool import leakfinder
 
+from pypy.interpreter.gateway import interp2app
 from pypy.interpreter.error import oefmt
 
 from pypy.module._cffi_backend import ctypefunc, ctypeprim, cdataobj, misc
@@ -218,6 +219,8 @@
             'free'                     : ([c_voidp],                  c_void),
 
             'charp2stdstring'          : ([c_ccharp, c_size_t],       
c_object),
+            #stdstring2charp  actually takes an size_t* as last parameter, but 
this will do
+            'stdstring2charp'          : ([c_ccharp, c_voidp],        
c_ccharp),
             'stdstring2stdstring'      : ([c_object],                 
c_object),
         }
 
@@ -525,11 +528,6 @@
 def c_charp2stdstring(space, svalue, sz):
     return _cdata_to_cobject(
         space, call_capi(space, 'charp2stdstring', [_Arg(s=svalue), 
_Arg(l=sz)]))
-_c_stdstring2charp = rffi.llexternal(
-    "cppyy_stdstring2charp",
-    [C_OBJECT, rffi.SIZE_TP], rffi.CCHARP,
-    releasegil=ts_helper,
-    compilation_info=eci)
 def c_stdstring2charp(space, cppstr):
     sz = lltype.malloc(rffi.SIZE_TP.TO, 1, flavor='raw')
     try:
diff --git a/pypy/module/cppyy/include/capi.h b/pypy/module/cppyy/include/capi.h
--- a/pypy/module/cppyy/include/capi.h
+++ b/pypy/module/cppyy/include/capi.h
@@ -179,7 +179,7 @@
     RPY_EXTERN
     cppyy_object_t cppyy_charp2stdstring(const char* str, size_t sz);
     RPY_EXTERN
-    char* cppyy_stdstring2charp(cppyy_object_t ptr, size_t* lsz);
+    const char* cppyy_stdstring2charp(cppyy_object_t ptr, size_t* lsz);
     RPY_EXTERN
     cppyy_object_t cppyy_stdstring2stdstring(cppyy_object_t ptr);
 
diff --git a/pypy/module/cppyy/src/clingcwrapper.cxx 
b/pypy/module/cppyy/src/clingcwrapper.cxx
--- a/pypy/module/cppyy/src/clingcwrapper.cxx
+++ b/pypy/module/cppyy/src/clingcwrapper.cxx
@@ -1467,9 +1467,9 @@
     return (cppyy_object_t)new std::string(str, sz);
 }
 
-char* cppyy_stdstring2charp(cppyy_object_t ptr, size_t* lsz) {
+const char* cppyy_stdstring2charp(cppyy_object_t ptr, size_t* lsz) {
     *lsz = ((std::string*)ptr)->size();
-    return (char*)((std::string*)ptr)->data();
+    return ((std::string*)ptr)->data();
 }
 
 cppyy_object_t cppyy_stdstring2stdstring(cppyy_object_t ptr){
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to