]> granicus.if.org Git - python/commitdiff
Explained more differences between PyList_SetItem() and PyList_SET_ITEM().
authorFred Drake <fdrake@acm.org>
Sun, 3 Jun 2001 03:12:57 +0000 (03:12 +0000)
committerFred Drake <fdrake@acm.org>
Sun, 3 Jun 2001 03:12:57 +0000 (03:12 +0000)
In particular, the affect on existing list content was not sufficiently
explained.

This closes SF bug #429554.

Doc/api/api.tex

index 613f62cb7365e9879bddc3d5dedafdbc1db0b7d2..a4886a7ec4c48f37b8944dbf329ba0814d64e9f9 100644 (file)
@@ -3304,13 +3304,18 @@ Macro form of \cfunction{PyList_GetItem()} without error checking.
 \begin{cfuncdesc}{int}{PyList_SetItem}{PyObject *list, int index,
                                        PyObject *item}
 Sets the item at index \var{index} in list to \var{item}.
-\strong{Note:}  This function ``steals'' a reference to \var{item}.
+\strong{Note:}  This function ``steals'' a reference to \var{item} and
+discards a reference to an item already in the list at the affected
+position.
 \end{cfuncdesc}
 
 \begin{cfuncdesc}{PyObject*}{PyList_SET_ITEM}{PyObject *list, int i,
                                               PyObject *o}
 Macro form of \cfunction{PyList_SetItem()} without error checking.
-\strong{Note:}  This function ``steals'' a reference to \var{item}.
+\strong{Note:}  This function ``steals'' a reference to \var{item},
+and, unlike \cfunction{PyList_SetItem()}, does \emph{not} discard a
+reference to any item that it being replaced.  This is normally only
+used to fill in new lists where there is no previous content..
 \end{cfuncdesc}
 
 \begin{cfuncdesc}{int}{PyList_Insert}{PyObject *list, int index,