[Twisted-Python] Win32 select in internet.main

Itamar Shtull-Trauring twisted at itamarst.org
Sun Nov 18 04:56:14 MST 2001


HappyFool pointed out on IRC that the fix for empty read and write lists in 
select.select on windows is only done for iterate(), not run(). Perhaps the 
following patch should be used?

Index: twisted/internet/main.py
===================================================================
RCS file: /cvs/Twisted/twisted/internet/main.py,v
retrieving revision 1.42
diff -c -r1.42 main.py
*** twisted/internet/main.py	2001/10/30 23:55:39	1.42
--- twisted/internet/main.py	2001/11/18 11:54:58
***************
*** 440,454 ****
           del writes[writer]

   if platform.getType() == 'win32':
!     """redefine iterate on WinXX to handle wierd error case when passing 
empty lists to select
       """
!     def iterate():
!         for delayed in delayeds:
!             delayed.runUntilCurrent()
!         if (not reads) and (not writes):
!             pass
           else:
!             doSelect(0)

   class _Win32Waker(styles.Ephemeral):
       """I am a workaround for the lack of pipes on win32.
--- 440,455 ----
           del writes[writer]

   if platform.getType() == 'win32':
!     """redefine select on WinXX to handle wierd error case when passing 
empty lists to select
       """
!     def _select(r, w, e, timeout=None, _realselect=select.select):
!         if (not r) and (not w):
!             return [], [], []
           else:
!             return _realselect(r, w, e, timeout)
!
!     select.select = _select
!

   class _Win32Waker(styles.Ephemeral):
       """I am a workaround for the lack of pipes on win32.






More information about the Twisted-Python mailing list