[pypy-commit] pypy cling-support: translater fixes

wlav pypy.commits at gmail.com
Thu Aug 18 19:03:17 EDT 2016


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: cling-support
Changeset: r86301:e2e2d5f25c36
Date: 2016-08-18 15:59 -0700
http://bitbucket.org/pypy/pypy/changeset/e2e2d5f25c36/

Log:	translater fixes

diff --git a/pypy/module/cppyy/capi/builtin_capi.py b/pypy/module/cppyy/capi/builtin_capi.py
--- a/pypy/module/cppyy/capi/builtin_capi.py
+++ b/pypy/module/cppyy/capi/builtin_capi.py
@@ -1,4 +1,5 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import jit
 
 import cling_capi as backend
@@ -165,7 +166,7 @@
     length = lltype.malloc(rffi.SIZE_TP.TO, 1, flavor='raw')
     try:
         cstr = _c_call_s(cppmethod, cppobject, nargs, args, length)
-        cstr_len = int(length[0])
+        cstr_len = intmask(length[0])
     finally:
         lltype.free(length, flavor='raw')
     return cstr, cstr_len
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
@@ -4,6 +4,7 @@
 
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import libffi, rdynload
 
 from pypy.module.cppyy.capi.capi_types import C_OBJECT
@@ -81,7 +82,7 @@
     sz = lltype.malloc(rffi.SIZE_TP.TO, 1, flavor='raw')
     try:
         cstr = _c_stdstring2charp(cppstr, sz)
-        cstr_len = int(sz[0])
+        cstr_len = intmask(sz[0])
     finally:
         lltype.free(sz, flavor='raw')
     return rffi.charpsize2str(cstr, cstr_len)
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
@@ -1,4 +1,5 @@
 from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import jit, jit_libffi, libffi, rdynload, objectmodel
 from rpython.rlib.rarithmetic import r_singlefloat
 from rpython.tool import leakfinder
@@ -349,7 +350,7 @@
         w_cstr = call_capi(space, 'call_s',
             [_Arg(h=cppmethod), _Arg(h=cppobject), _Arg(l=nargs), _Arg(vp=cargs),
              _Arg(vp=rffi.cast(rffi.VOIDP, length))])
-        cstr_len = int(length[0])
+        cstr_len = intmask(length[0])
     finally:
         lltype.free(length, flavor='raw')
     return _cdata_to_ccharp(space, w_cstr), cstr_len
@@ -540,7 +541,7 @@
     try:
         w_cstr = call_capi(space, 'stdstring2charp',
             [_Arg(h=cppstr), _Arg(vp=rffi.cast(rffi.VOIDP, sz))])
-        cstr_len = int(sz[0])
+        cstr_len = intmask(sz[0])
     finally:
         lltype.free(sz, flavor='raw')
     return rffi.charpsize2str(_cdata_to_ccharp(space, w_cstr), cstr_len)


More information about the pypy-commit mailing list