char** to {'':('',)}

Thomas Wouters thomas at xs4all.net
Wed Sep 5 06:09:28 EDT 2001


On Wed, Aug 29, 2001 at 04:35:32PM -0400, Ignacio Vazquez-Abrams wrote:

> I've noticed two big holes in the Python/C API:

> 1) It doesn't say for all functions which ones set exceptions, and

All functions that return an error code set an appropriate exception, unless
otherwise stated in the documentation. I can't think of a function that
doesn't set an exception, off the top of my head. Some functions (like
'PyInt_AsLong' and such) can return their error value legitimately, and
require an extra 'PyErr_Occured()' check, but they do set an exception.

> 2) It doesn't say for all functions whether or not they increment
>      refcounts of objects passed to them, viz. PyDict_SetString().

No functions steal reference or return borrowed references unless the
documentation says so, in aggressively red lettering :) PyDict_SetString()
doesn't steal a reference, so it must copy it (or not keep it around -- the
caller needn't know the difference.)

I-won't-argue-goto-but-I-never-say-never-myself-ly y'rs ;P
-- 
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