<div class="gmail_quote">On Wed, Oct 14, 2009 at 6:05 PM, Neil Schemenauer <span dir="ltr">&lt;<a href="mailto:nas@arctrix.com">nas@arctrix.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
   def __del__():<br>
        print sys.version<br>
<br>
the global variable reference to &#39;sys&#39; is not a reference on the GC<br>
referencing counting sense. IOW, it does not result in a a Py_INCREF<br>
while the function is not being executed and therefore should be<br>
safe after the proposed change. Currently, it could result in &#39;None&#39;<br>
being printed.<br></blockquote></div><br>Currently it throws an exception since &quot;sys&quot; is None. :-)<br><br>Here is my understanding of the proposed procedure:<br><br>1. Replace modules in sys.modules with weakrefs<br>
2. Run the garbage collector<br>3. Replace globals in any remaining modules with None<br>4. Run the garbage collector<br><br>Is it possible for a __del__ method to be called in step 4 or not?  I am still unclear on this point. :-)<br>
<blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>