[ZODB-Dev] [Where to submit bugs for ZODB3-3.1b1] - ZEO - Linux-only dependency??

Guido van Rossum guido@python.org
Sun, 22 Sep 2002 22:44:05 -0400


> ZEO/zrpc/connection.py:
> 
>     def pending(self):
>         """Invoke mainloop until any pending messages are handled."""
> ..............
> Line 392:
>         poll = select.poll()
> 
> It seems that 'select.poll' is not available on windows :( 

Can you try this patch, which uses select.select()?  (There's no test
suite for this, and I have no time to write one right now, but I think
this should do it -- it's pretty straightforward.)

Index: connection.py
===================================================================
RCS file: /cvs-repository/ZODB3/ZEO/zrpc/connection.py,v
retrieving revision 1.32
diff -c -r1.32 connection.py
*** connection.py	20 Sep 2002 17:37:34 -0000	1.32
--- connection.py	23 Sep 2002 02:44:23 -0000
***************
*** 395,419 ****
          # Inline the asyncore poll3 function to know whether any input
          # was actually read.  Repeat until no input is ready.
          # XXX This only does reads.
-         poll = select.poll()
-         poll.register(self._fileno, select.POLLIN)
          # put dummy value in r so we enter the while loop the first time
!         r = [(self._fileno, None)]
!         while r:
              try:
!                 r = poll.poll()
              except select.error, err:
                  if err[0] == errno.EINTR:
                      continue
                  else:
                      raise
!             if r:
!                 try:
!                     self.handle_read_event()
!                 except asyncore.ExitNow:
!                     raise
!                 else:
!                     self.handle_error()
  
  class ManagedServerConnection(Connection):
      """Server-side Connection subclass."""
--- 395,420 ----
          # Inline the asyncore poll3 function to know whether any input
          # was actually read.  Repeat until no input is ready.
          # XXX This only does reads.
          # put dummy value in r so we enter the while loop the first time
!         r_in = [self._fileno]
!         w_in = []
!         x_in = []
!         while 1:
              try:
!                 r, w, x = select.select(r_in, w_in, x_in, 0)
              except select.error, err:
                  if err[0] == errno.EINTR:
                      continue
                  else:
                      raise
!             if not r:
!                 break
!             try:
!                 self.handle_read_event()
!             except asyncore.ExitNow:
!                 raise
!             else:
!                 self.handle_error()
  
  class ManagedServerConnection(Connection):
      """Server-side Connection subclass."""

--Guido van Rossum (home page: http://www.python.org/~guido/)