Message22917
Logged In: YES
user_id=31435
> There is only one minor issue that I can think of. We
> decide which callbacks to invoke inside
> move_troublemakers(). It's possible that unreachable
> weakrefs become reachable when
> move_finalizer_reachable() is called (i.e. weakrefs that
> would be trash except that they got revived because they
> were referenced by an object with a __del__ method).
>
> However, since those weakrefs would have been trash I
> think it's okay not to invoke their callbacks.
I sure agree there are grey areas here! Since I hate __del__
methods, I'm afraid I tend to have a "oh, who gives a shit?"
attitude toward them.
There are also grey areas here outside of cyclic gc. Take a
look at subtype_dealloc: that calls PyObject_ClearWeakRefs
() before calling a __del__ method, so invokes weakref
callbacks even if the object doesn't actually go away (the
__del__ method could still resurrect it). Is that right or
wrong? Beats me.
I need to think more about this. Offhand I'm inclined to agree
that your reworking to crawl over unreachable twice is the
more principled approach. I only cringe because it *is*
twice, and so probably a little slower.
Can you write a test where it makes a visible difference? |
|
Date |
User |
Action |
Args |
2007-08-23 14:27:07 | admin | link | issue1055820 messages |
2007-08-23 14:27:07 | admin | create | |
|