This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amajorek
Recipients amajorek, beardedp, giampaolo.rodola
Date 2011-06-01.20:23:47
SpamBayes Score 0.0008260119
Marked as misclassified No
Message-id <1306959828.54.0.454799757127.issue11453@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-06-01 20:23:48amajoreksetrecipients: + amajorek, giampaolo.rodola, beardedp
2011-06-01 20:23:48amajoreksetmessageid: <1306959828.54.0.454799757127.issue11453@psf.upfronthosting.co.za>
2011-06-01 20:23:48amajoreklinkissue11453 messages
2011-06-01 20:23:47amajorekcreate