@@ -82,7 +82,7 @@ Tuple Objects
8282.. c :function :: PyObject* PyTuple_GetItem (PyObject *p, Py_ssize_t pos)
8383
8484 Return the object at position *pos * in the tuple pointed to by *p *. If *pos * is
85- out of bounds, return *NULL * and sets an :exc: `IndexError ` exception.
85+ out of bounds, return *NULL * and set an :exc: `IndexError ` exception.
8686
8787 .. versionchanged :: 2.5
8888 This function used an :c:type: `int ` type for *pos *. This might require
@@ -100,8 +100,9 @@ Tuple Objects
100100
101101.. c :function :: PyObject* PyTuple_GetSlice (PyObject *p, Py_ssize_t low, Py_ssize_t high)
102102
103- Take a slice of the tuple pointed to by *p * from *low * to *high * and return it
104- as a new tuple.
103+ Return the slice of the tuple pointed to by *p * between *low * and *high *,
104+ or *NULL * on failure. This is the equivalent of the Python expression
105+ ``p[low:high] ``. Indexing from the end of the list is not supported.
105106
106107 .. versionchanged :: 2.5
107108 This function used an :c:type: `int ` type for *low * and *high *. This might
@@ -111,11 +112,13 @@ Tuple Objects
111112.. c :function :: int PyTuple_SetItem (PyObject *p, Py_ssize_t pos, PyObject *o)
112113
113114 Insert a reference to object *o * at position *pos * of the tuple pointed to by
114- *p *. Return ``0 `` on success.
115+ *p *. Return ``0 `` on success. If *pos * is out of bounds, return ``-1 ``
116+ and set an :exc: `IndexError ` exception.
115117
116118 .. note ::
117119
118- This function "steals" a reference to *o *.
120+ This function "steals" a reference to *o * and discards a reference to
121+ an item already in the tuple at the affected position.
119122
120123 .. versionchanged :: 2.5
121124 This function used an :c:type: `int ` type for *pos *. This might require
@@ -129,7 +132,10 @@ Tuple Objects
129132
130133 .. note ::
131134
132- This function "steals" a reference to *o *.
135+ This macro "steals" a reference to *o *, and, unlike
136+ :c:func: `PyTuple_SetItem `, does *not * discard a reference to any item that
137+ is being replaced; any reference in the tuple at position *pos * will be
138+ leaked.
133139
134140 .. versionchanged :: 2.5
135141 This function used an :c:type: `int ` type for *pos *. This might require
0 commit comments