]> granicus.if.org Git - python/commitdiff
Fred's right -- we need PyList_SET_ITEM().
authorGuido van Rossum <guido@python.org>
Fri, 24 Apr 1998 18:22:02 +0000 (18:22 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 24 Apr 1998 18:22:02 +0000 (18:22 +0000)
Doc/api.tex
Doc/api/api.tex
Include/listobject.h
Python/bltinmodule.c

index 5f168f2f982bb8fbbad525d4a756279be90f836c..b0b7bfd14aa5b8a4884c86ae58b74d56e7a3436e 100644 (file)
@@ -1953,6 +1953,11 @@ Returns a new tuple object containing the contents of \var{list}.
 Macro form of \cfunction{PyList_GetItem()} without error checking.
 \end{cfuncdesc}
 
+\begin{cfuncdesc}{PyObject*}{PyList_SET_ITEM}{PyObject *list, int i,
+                                              PyObject *o}
+Macro form of \cfunction{PyList_SetItem()} without error checking.
+\end{cfuncdesc}
+
 \begin{cfuncdesc}{int}{PyList_GET_SIZE}{PyObject *list}
 Macro form of \cfunction{PyList_GetSize()} without error checking.
 \end{cfuncdesc}
index 5f168f2f982bb8fbbad525d4a756279be90f836c..b0b7bfd14aa5b8a4884c86ae58b74d56e7a3436e 100644 (file)
@@ -1953,6 +1953,11 @@ Returns a new tuple object containing the contents of \var{list}.
 Macro form of \cfunction{PyList_GetItem()} without error checking.
 \end{cfuncdesc}
 
+\begin{cfuncdesc}{PyObject*}{PyList_SET_ITEM}{PyObject *list, int i,
+                                              PyObject *o}
+Macro form of \cfunction{PyList_SetItem()} without error checking.
+\end{cfuncdesc}
+
 \begin{cfuncdesc}{int}{PyList_GET_SIZE}{PyObject *list}
 Macro form of \cfunction{PyList_GetSize()} without error checking.
 \end{cfuncdesc}
index c1bbcc17f5edae826cbb72fe9012c7dd28f973be..e99acef1b9626df3a46b14774f066a185125bc35 100644 (file)
@@ -74,6 +74,7 @@ extern PyObject *PyList_AsTuple Py_PROTO((PyObject *));
 
 /* Macro, trading safety for speed */
 #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
+#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
 #define PyList_GET_SIZE(op)    (((PyListObject *)(op))->ob_size)
 
 #ifdef __cplusplus
index 8a4215bad5c984a34c6cf9b60c72da5ff128dc55..fd31405733d29d9a0063c1780690f825f63e6775 100644 (file)
@@ -1282,7 +1282,7 @@ builtin_range(self, args)
                        Py_DECREF(v);
                        return NULL;
                }
-               PyList_GET_ITEM(v, i) = w;
+               PyList_SET_ITEM(v, i, w);
                ilow += istep;
        }
        return v;