示例#1
0
 def _unwrap_object(self, space, w_obj):
     from pypy.module.cppyy.interp_cppyy import W_CPPInstance
     if isinstance(w_obj, W_CPPInstance):
         arg = InstanceConverter._unwrap_object(self, space, w_obj)
         return capi.c_stdstring2stdstring(space, arg)
     else:
         return capi.c_charp2stdstring(space, space.str_w(w_obj))
示例#2
0
文件: converter.py 项目: charred/pypy
 def _unwrap_object(self, space, w_obj):
     try:
         return capi.c_charp2stdstring(space, space.str_w(w_obj))
     except Exception, e:
         arg = InstanceConverter._unwrap_object(self, space, w_obj)
         result = capi.c_stdstring2stdstring(space, arg)
         return result
示例#3
0
 def _unwrap_object(self, space, w_obj):
     from pypy.module.cppyy.interp_cppyy import W_CPPInstance
     if isinstance(w_obj, W_CPPInstance):
         arg = InstanceConverter._unwrap_object(self, space, w_obj)
         return capi.c_stdstring2stdstring(space, arg)
     else:
         return capi.c_charp2stdstring(space, space.str_w(w_obj))
示例#4
0
 def _unwrap_object(self, space, w_obj):
     try:
        charp = rffi.str2charp(space.str_w(w_obj))
        arg = capi.c_charp2stdstring(charp)
        rffi.free_charp(charp)
        return arg
     except OperationError:
        arg = InstanceConverter._unwrap_object(self, space, w_obj)
        return capi.c_stdstring2stdstring(arg)