Commit f4cf6a53 authored by Jim Fulton's avatar Jim Fulton

It turns out the fix for the file-descriptor leak was only relevent to

Python 2.6, where asyncore.file_wrapper was changed to dup it's the
file-descriptor passed to it. :(  Fixed the fix to work withor or not
the fd is duped.
parent 4c3ea088
......@@ -140,8 +140,14 @@ if os.name == 'posix':
r, self.trigger = os.pipe()
asyncore.file_dispatcher.__init__(self, r, map)
# file_dispatcher dups r, so we don't need it any more
os.close(r)
if self.fd != r:
# Starting in Python 2.6, the descriptor passed to
# file_dispatcher gets duped and assigned to
# self.fd. This breals the instantiation semantics and
# is a bug imo. I dount it will get fixed, but maybe
# it will. Who knows. For that reason, we test for the
# fd changing rather than just checking the Python version.
os.close(r)
def _close(self):
os.close(self.trigger)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment