Thanks for your points, I will try explain my problem better:

In my library I have a parent->child control then when the parent is
deleted all children is deleted too.

but in python I would like change this behavior, if there is some
python object using my child I will not delete this object.

The problem here is, some children is created in c++ code without
communicate to python. Then during the parent destructor I would like
to know which child are create in c++ and which is created in python,
for check this I'm using refcount, if recount > 1 then there is some
python object using this else I can delete this.

But after some tests this way to create python object using
"obj(ptr(my_object))" if the object is new (not exists in python) the
refcount is 1 and if there is only 1 python object using this the
refcount is 1 too, then this cause me a problem.




On Wed, Dec 3, 2008 at 4:16 PM, Stefan Seefeld <[EMAIL PROTECTED]> wrote:
> Renato Araujo wrote:
>>
>> Hi all,
>>
>> I'm trying check  if have someone using my object in python, but I got
>> some problems I think I'm not doing this in the correct way:
>>
>
> First of all, I'm not sure I understand what you are trying to achieve. Why
> do you want to manually delete reference-counted objects, instead of letting
> Python's runtime do this ?

Renato Araujo Oliveira Filho
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to