Beispiel #1
0
 def getitem(self, space, num):
     if not self.ll_buffer:
         raise segfault_exception(space, "accessing elements of freed array")
     if num >= self.length or num < 0:
         raise OperationError(space.w_IndexError, space.w_None)
     return wrap_value(space, read_ptr, self.ll_buffer, num,
                       self.shape.itemcode)
Beispiel #2
0
 def getitem(self, space, num):
     if not self.ll_buffer:
         raise segfault_exception(space, "accessing elements of freed array")
     if num >= self.length or num < 0:
         raise OperationError(space.w_IndexError, space.w_None)
     return wrap_value(space, read_ptr, self.ll_buffer, num,
                       self.shape.itemcode)
Beispiel #3
0
def callback(ll_args, ll_res, ll_userdata):
    userdata = rffi.cast(USERDATA_P, ll_userdata)
    callback_ptr = global_counter.CallbackPtr_by_number[userdata.addarg]
    w_callable = callback_ptr.w_callable
    res = rffi.cast(rffi.VOIDPP, ll_res)
    argtypes = callback_ptr.args
    space = callback_ptr.space
    w_args = space.newlist([wrap_value(space, get_elem, ll_args[i], 0,
                                       letter2tp(space, argtypes[i]))
                            for i in range(len(argtypes))])
    w_res = space.call(w_callable, w_args)
    unwrap_value(space, push_elem, ll_res, 0,
                 letter2tp(space, callback_ptr.result), w_res)
Beispiel #4
0
 def getattr(self, space, attr):
     if not self.ll_buffer:
         raise segfault_exception(space, "accessing NULL pointer")
     i = self.shape.getindex(space, attr)
     _, tp, _ = self.shape.fields[i]
     return wrap_value(space, cast_pos, self, i, tp.itemcode)
Beispiel #5
0
 def getattr(self, space, attr):
     if not self.ll_buffer:
         raise segfault_exception(space, "accessing NULL pointer")
     i = self.shape.getindex(space, attr)
     _, tp, _ = self.shape.fields[i]
     return wrap_value(space, cast_pos, self, i, tp.itemcode)