memory leak - C API

Thomas Heller theller at
Sat Dec 6 00:22:41 CET 2003

John Hunter <jdhunter at> writes:

>>>>>> "Tim" == Tim Peters < at> 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
<>, 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.


More information about the Python-list mailing list