[Python-Dev] asyncore.poll behaviour

Kjetil Jacobsen kjetilja@cs.uit.no
19 Feb 2002 14:04:44 +0100


hello,

in python2.2 the semantics for asyncore.poll (which uses the select()
system call) is different than for asyncore.poll3 (which uses the poll()
system call) when an EINTR exception occurs.  in asyncore.poll3, the
pollset is correctly reset to an empty list, but in asyncore.poll this
is not done, which in turn causes a lot of strange things to happen when
an EINTR occurs (spurious handler invocations and so on).

i've tried to upload the patch to sourceforge, but the patch manager has
not responded for me the last couple of days so i'm sending it here
instead.  

the fix is a simple one-liner which makes the semantics of asyncore.poll
and asyncore.poll3 similar:

*** /usr/local/lib/python2.2/asyncore.py        Wed Jan 30 15:51:00 2002
--- asyncore.py Wed Jan 30 16:19:28 2002
***************
*** 80,85 ****
--- 80,86 ----
          except select.error, err:
              if err[0] != EINTR:
                  raise
+             r, w, e = [], [], []
  
          if DEBUG:
              print r,w,e


btw, the asyncore.poll2 function does not seems to have either the
behaviour of asyncore.poll or asyncore.poll3 with respect to handling of
EINTR.  perhaps asyncore.poll2 should be removed altogether or just
remapped to asyncore.poll3?

regards,

	- kjetil