On Mon, Nov 17, 2003 at 05:57:06PM -0500, Tim Peters wrote: > That's the primary reason I was loathe to run __del__ methods in > an arbitrary order: horrid order-dependent bugs can easily escape > non-exhaustive testing Very good point. I had forgotten about that issue. > For that reason, I'm growing increasingly fond of the idea of clearing the > trash weakrefs first. If no callbacks get invoked, the order they're not > invoked in probably doesn't matter <wink>. The technical hangup with that > one right now is that clearing a weakref decrefs the callback, which can > make the callback object die, and the callback object can itself have a > weakref (with a different callback) pointing to *it*. In that case, > arbitrary Python code gets executed during gc, and in an arbitrary order > again. There must be a hack to worm around that. A hack you say? Create a list the references itself (i.e. append itself). Append all the unreachable callbacks to it and remove them from the weakrefs. Put the list in the youngest generation. The next gc should clean it up. Neil
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4