[IPython-dev] Bug with __del__methods on exit

Thomas Kluyver takowl at gmail.com
Sat Oct 9 12:45:59 EDT 2010


Hi,

I recently found a problem in my python 3 port of ipython, where the __del__
method of objects, called as the program was exiting, could not find global
functions.

On a hunch, I've just tested this in standard ipython, both 0.10 (in Ubuntu)
and trunk. The problem exists in both cases (it only came to light in Python
3 because print is a function). The minimal code to reproduce it is:

class A(object):
    def __del__(self):
        input("ABC")

a = A()
exit()

Which gives: Exception NameError: "global name 'input' is not defined" in
<bound method A.__del__ of <__main__.A object at 0x98634cc>> ignored

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20101009/a68dd1ea/attachment.html>


More information about the IPython-dev mailing list