[Checkins] SVN: zc.ngi/trunk/src/zc/ngi/async.py Copied a trigger fix from ZEO.

Jim Fulton jim at zope.com
Tue Jul 6 06:35:29 EDT 2010


Log message for revision 114228:
  Copied a trigger fix from ZEO.
  

Changed:
  U   zc.ngi/trunk/src/zc/ngi/async.py

-=-
Modified: zc.ngi/trunk/src/zc/ngi/async.py
===================================================================
--- zc.ngi/trunk/src/zc/ngi/async.py	2010-07-06 09:30:57 UTC (rev 114227)
+++ zc.ngi/trunk/src/zc/ngi/async.py	2010-07-06 10:35:28 UTC (rev 114228)
@@ -676,8 +676,14 @@
             r, self.__writefd = 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 breaks 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.__writefd)



More information about the checkins mailing list