[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Functions that steal references (Re: [pygame] [patch] minor memory leaks...)



Bring it up with python-core then. They at the least should have a consistent failure condition. Unless things have gone HORRENDOUSLY wrong at which point its better to just shut down than to deal with the error.

-Tyler

On Tue, Jun 16, 2009 at 5:34 PM, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
Lenard Lindstrom wrote:

What a function that steals a reference does with an error is undocumented. PyModule_AddObject only steals a referenece when it succeeds. PyList_SetItem and PyTuple_SetItem always steals a reference. The only way to find out which is the case is to examine the Python source code.

Well, that's pretty unsatisfactory. The refcounting
behaviour on failure is just as important as any
other part of the function's spec, and needs to
be documented somewhere.

--
Greg



--
Visit my blog at http://oddco.ca/zeroth/zblog