tuple creation in C extensions

Thomas Wouters thomas at xs4all.net
Wed Jun 14 12:45:08 EDT 2000


On Wed, Jun 14, 2000 at 12:30:27PM -0400, Alex wrote:

> I was thinking it ought to be possible to write a script that would pull
> the signatures of the API functions from the docs, and write some C code
> to determine their refence count effects.  You might be able to get a
> long way to the sort of table we need that way.

The docs already have that:

   PyObject* PyList_GetItem (PyObject *list, int index)

   Return value: Borrowed reference.

          Returns the object at position pos in the list pointed to by p.
          If pos is out of bounds, returns NULL and sets an IndexError
          exception.

   PyObject* PyList_New (int len)

   Return value: New reference.

          Returns a new list of length len on success, or NULL on
          failure.

   PyObject* PyList_GetSlice (PyObject *list, int low, int high)

   Return value: New reference.

          Returns a list of the objects in list containing the objects
          between low and high. Returns NULL and sets an exception if
          unsuccessful. Analogous to list[low:high].

And:

   int PyList_SetItem (PyObject *list, int index, PyObject *item)
          Sets the item at index index in list to item. Note: This
          function `steals'' a reference to item.


-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list