Ejemplo n.º 1
0
// int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)
// Set the item at index index in list to item. Return 0 on success or -1 on failure.
//
// Note This function “steals” a reference to item and discards a reference to an item already in the list at the affected position.
// Changed in version 2.5: This function used an int for index. This might require changes in your code for properly supporting 64-bit systems.
func PyList_SetItem(self *PyObject, index int, item *PyObject) error {
	err := C.PyList_SetItem(topy(self), C.Py_ssize_t(index), topy(item))
	return int2err(err)
}
Ejemplo n.º 2
0
Archivo: list.go Proyecto: z0mbie42/py3
// Insert a reference to object o at position pos in the list pointed to by self
// Return 0 on success.
// Note This function “steals” a reference to o.
func (self *List) SetItem(pos int, obj *PyObject) int {
	ret := C.PyList_SetItem(self.ptr, C.Py_ssize_t(pos), obj.ptr)
	return (int)(ret)
	// return int2Err(ret)
}
Ejemplo n.º 3
0
// SetItem sets the Object at index idx in list l to Object obj.
//
// Note: This method "steals" a reference to obj, and discards a reference to
// the current value of idx in l (if there is one).
func (l *List) SetItem(idx int64, obj Object) error {
	ret := C.PyList_SetItem(c(l), C.Py_ssize_t(idx), c(obj))
	return int2Err(ret)
}