[Bf-python] PYTHONPATH

Stephen Swaney sswaney at swbell.net
Sat Sep 13 07:49:47 CEST 2003


Willian Padovani Germano wrote:
> 
> Looks fine, but it's probably necessary to incref the strings before
> appending them to sys.path, look below:
> 
> > +   item  = PyList_GetItem( p, index );  /* borrowed ref */
> 
> here: Py_INCREF(item);
> (or use PySequence_GetItem, instead of PyList_GetItem)
> 
> > +   syspath_append( item );

This is because, even though it's a borrowed reference, we pass it
on to someone who hangs on to it, right?  It seems obvious now
that you point it out!

I confess I was not aware of the more generic PySequence_GetItem().
Good stuff to know.  Thanks, Willian!

-- 
Stephen Swaney			
sswaney at swbell.net



More information about the Bf-python mailing list