PyArg_ParseTuple O format semantics

Tim Peters tim.one at home.com
Fri Sep 7 21:12:35 EDT 2001


[Robin Becker]
> Steve Alexander kindly forwarded me a note relating to a change in
> getargs.c that occurred between  2.0 and 2.0.1. Basically it was implied
> that O format conversion was buggy before in term of the refcount of the
> returned object.

News to me, and I see nothing about that in the CVS log.  The only 2.0.1
patch to getargs.c plugged a memory leak in vgetargskeywords(); it was
leaving the refcounts on names of keyword arguments too high, when iterating
over a keyword dict.

> The documentation doesn't mention any increment so it seems to return a
> borrowed ref.

The docs are explicit:  "any Python object references which are provided to
the caller are borrowed references; do not decrement their reference
count!".

> I'm using the O flag a bit and would like to know if I should be
> patching to cover the change -->2.0.1?

Doubt it; there doesn't appeart to be any relevant change in 2.0.1, but I
haven't seen the note you're paraphrasing either.





More information about the Python-list mailing list