Re: Py_DECREF Question:

2005-08-15 Thread Raymond Hettinger
[Jeremy Moles] > When I add an object created locally to a mapping or sequence (that will > be returned from a function into an running instance of the Python > interpreter), I need to call Py_DECREF on the object, right? It depends on the the function or macro, but usually the answer is Yes. The

Re: Py_DECREF Question:

2005-08-15 Thread Scott David Daniels
Jeremy Moles wrote: > When I add an object created locally to a mapping or sequence ... > I need to call Py_DECREF on the object, right? ... for example: > PyObject* list = Py_Buildvalue("[]"); > ... > PyObject* num = Py_BuildValue("i", 10); > PyList_Append(list, num); > ..

Py_DECREF Question:

2005-08-15 Thread Jeremy Moles
When I add an object created locally to a mapping or sequence (that will be returned from a function into an running instance of the Python interpreter), I need to call Py_DECREF on the object, right? Unfortunately, I really feel like the following code leaks memory... --- for example --- PyObjec