[Taking this to email. Carrying out discussions via the SF bug tracker sucks.] Comment By: Tim Peters (tim_one) > [Neil] > > I had to change _PyWeakref_ClearRef() since it was also > > clearing the weakref list of the trash object. > > That was really its *purpose*. If a trash weakref with a > callback isn't removed from the referent's list of weakrefs, > then the callback will trigger when PyObject_ClearWeakRefs() > is invoked on the referent. The purpose of > _PyWeakref_ClearRef() was to ensure that the callback never > triggers. But it's okay of the callback triggers, as long as the callback doesn't reference trash. > > Now it just sets wr_object to Py_None. > > That won't stop the callback from triggering. It also means > (see earlier comment) that PyObject_ClearWeakRefs() will > never removed the weakref from the list either, although I'm > not sure that does real harm. I'm trying to figure out PyObject_ClearWeakRefs() right now. > > I also made some serious simplifications to gcmodule by > > just treating trash weakref objects with callbacks the same > > as objects with __del__ methods (i.e. move them to the > > finalizers list and then do the transitive closure of that set). > > Does that mean they can end up in gc.garbage too? If so, I > don't think that's sellable. I think so. That can be easily changed though. What we can't do is invoke those callbacks. 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