Aldona Majorek <amajo...@google.com> added the comment:

Adding __exit__ will not make asyncore.file_wrapper close file descriptor when 
garbage collected.

Here is clone of socket.py solution for the same problem.

  def close(self):
    if self.fd:
      os.close(self.fd)
      self.fd = None # or maybe self.fd = 0 will be better

  def __del__(self):
    try:
      self.close()
    except:
      # close() may fail if __init__ didn't complete
      pass

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11453>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to