Decrementing of reference count of new objects?

  • Thread starter Mitko Haralanov
  • Start date
M

Mitko Haralanov

For the most part, I understand the theory behind reference counting in
Python C code. But there is one thing that I am confused about and I
have not been able to clear it up.

Let say that you have the following function (over-simplified):

PyObject *do_work (PyObject *self, PyObject *args) {
PyObject *new_obj;
new_obj = PyDict_New ();
return new_obj;
}

What I don't get is whether I have to decrement the reference to
new_obj before I return it. I know that function that return object are
giving away the reference but I am still confused.

Thanks for all your help!
--
Mitko Haralanov (e-mail address removed)
Senior Software Engineer 650.934.8064
HSG InfiniBand Engineering http://www.qlogic.com

==========================================
11. Any more trouble from you and your account gets moved to the 750

--Top 100 things you don't want the sysadmin to say
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top