memory leak - C API

Thomas Heller theller at python.net
Fri Dec 5 18:22:41 EST 2003


John Hunter <jdhunter at ace.bsd.uchicago.edu> writes:

>>>>>> "Tim" == Tim Peters <tim.one at comcast.net> writes:
>
>     Tim> Where did that understanding come from?  It's important to
>     Tim> track it down, because whatever source you got it from is
>     Tim> unreliable.  This one is such a common misconception that the
>     Tim> docs (Python C/API Reference Manual, section "Reference Count
>     Tim> Details") point it out explicitly:
>
> Argg... I got it from reading the API for PyList_GetItem and
> *assuming* it worked the same way for PySequence_GetItem.  I was using
> the PyList API as a stand-in for the sequence API because I didn't
> find the PySequence API.

You cannot assume *anything* about the C api functions, the reference is
the definite way to find out about them.

A nice way (IMO, but I'm biased) is to use the Python Index search at
<http://starship.python.net/crew/theller/pyhelp.cgi>, although (on
windows) the html help file provides the same information.

Back in the past, it was a good idea to read the header files, but the
docs have quite improved.

Thomas




More information about the Python-list mailing list