#10 __del__ should be careful calling close

open
nobody
None
5
2014-08-23
2006-11-07
Anonymous
No

pexpect.__del__() calls pexpect._close() which calls
os.close(). When the program is terminating, the os
module may be deleted before pexpect.__del__() is
called, causing None.close() to called and raising an
AttributeError. Python correctly suppress the
exception and prints a warning, but the warning is
annoying.

A work-around is to only call pexpect._close() if os in
not None.

See also the note here:
http://docs.python.org/ref/customization.html

David
dhelder@gizmolabs.org

Discussion