[C++-sig] Re: Pyste feature: class member deletion o

Niall Douglas s_sourceforge at nedprod.com
Mon Nov 10 05:49:30 CET 2003

On 9 Nov 2003 at 14:52, David Abrahams wrote:

> > I can't see how that would happen. The bottom-most children (who
> > don't have any extra things holding a reference to them) when
> > deleted decrement the reference count of their parents. If a
> > parent has no other thing using it, it too gets deleted.
> The children won't get deleted, because they are part of a reference
> cycle.  Please think a bit more before arguing with me.

You're right - I was forgetting that the parent object's __del__ only
gets called when its reference count goes to zero, which never could
happen if its children all were holding a reference to it.

Hmm, back to the drawing board then. The best I've so far thought of
is a custom __del__() method which deletes the children in reverse
order. Perhaps though this could be automated by some code
datestamping member creation and deleting them in reverse
chronological order? Maybe some sort of bucket provided by Raoul's
indexing suite. Hmm, the mind is a-ticking ...

I take it there's no way of asking BPL to tell python to invalidate 
any references pointing to some C++ object? Perhaps I mean to say 
that BPL could be told that some object pointer is no longer valid, 
so it throws a python exception if anyone tries to use it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 208 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20031110/8486ab1a/attachment.pgp>

More information about the Cplusplus-sig mailing list