On Jun 29, 3:04 pm, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > eyal.lotem+pyutils <at> gmail.com <eyal.lotem <at> gmail.com> writes: > > > This is exactly what my post tried to address. > > I assumed it was clear that module clearing is the wrong solution, and > > that it was also clear that due to the cycles I mentioned > > (global.__class__.__dict__['any_method'].func_globals['global'] is > > global), all globals that have a __del__ will not be collectible. > > Therefore, I proposed a solution to cycles with a __del__ in them. > > Only with this solution it is possible to replace module clearing with > > normal garbage collection. > > A more generic solution would be to pass a special flag to the GC when it is > called as part of interpreter shutdown. This flag would instruct it to not put > aside objects with finalizers, but first call all their __del__ methods and > then > collect them all at once regardless of whether they are part of a cycle or > not.
That would be no worse than what happens now - but its still not perfect (__del__ ordering issues). Also, you would need to temporarily revive the cycles as mentioned above (to avoid accessibility of partially destructed objects). > > _______________________________________________ > Python-Dev mailing list > [EMAIL PROTECTED]://mail.python.org/mailman/listinfo/python-dev > Unsubscribe:http://mail.python.org/mailman/options/python-dev/python-dev2-garchiv... _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com