On Fri, Mar 21, 2008 at 11:32 AM, Robert Dailey
Hi,
I had a bit of trouble deciding which mailing list to post this question (Python or boost). I decided to post it here since the way I'm extending is boost-specific, however the fundamental question is in regards to how Python internally handles ownership. I do not feel there is a perfect location for this question, so I hope you'll forgive the semi-off topicness of the question.
Right now I'm exposing a function to Python that returns a pointer to a custom object owned by a third party library. In most cases I can manage to use boost::shared_ptr when I'm returning pointers, however since this is a third party library I cannot do this. Since the pointer I'm returning is owned and managed by another object, I gave my def() the following return policy:
return_value_policy
() I simply assumed this was correct. How does Python handle the pointer to this object? Is there some documents in either boost or the python documentation that I can read to understand a little more about how Python handles object ownership when the Python objects really represent C++ pointers? Perhaps someone could give me a brief rundown on the concept.
Thanks in advance.
*bump*