def bytearray_insert__Bytearray_Int_ANY(space, w_bytearray, w_idx, w_other): where = space.int_w(w_idx) length = len(w_bytearray.data) index = get_positive_index(where, length) val = getbytevalue(space, w_other) w_bytearray.data.insert(index, val) return space.w_None
def setitem__Bytearray_ANY_ANY(space, w_bytearray, w_index, w_item): from pypy.objspace.std.bytearraytype import getbytevalue idx = space.getindex_w(w_index, space.w_IndexError, "bytearray index") try: w_bytearray.data[idx] = getbytevalue(space, w_item) except IndexError: raise OperationError(space.w_IndexError, space.wrap("bytearray index out of range"))
def list_append__Bytearray_ANY(space, w_bytearray, w_item): from pypy.objspace.std.bytearraytype import getbytevalue w_bytearray.data.append(getbytevalue(space, w_item))