[Python-Dev] Assign to errno allowed?
Guido van Rossum
Tue, 24 Sep 2002 12:02:36 -0400
> > > Although it could be argued whether it makes sense to simulate
> > > a Linux-compatible select for Windows.
> > Nah, it's been like this for a decade.
> In the current form, it breaks asyncore - this is what
> I wanted to fix in the first place.
> asyncore contains this code snippet in the poll() function:
> r,w,e = select.select (r,w,e, timeout)
> except select.error, err:
> if err != EINTR:
> r = ; w = ; e = 
> This will fail on Windows if all of r,w,e are empty.
Apparently asyncore has never worked properly on Windows. Note that
it also doesn't check for the Windows error codes on connect().
> Even if there are active sockets, it may be that this
> code is executed with all three lists empty.
> How can this be fixed?
Change poll() in asyncore.py to use this:
if  == r == w == e:
r, w, e = select.select(r, w, e, timeout)
except select.error, err:
> I have an SF item at http://www.python.org/sf/611464 discussing this.
The conclusion there seems that select() should be fixed, but then
goes on to say that there's no easy way to make it interruptible.
Since we don't try to hide the differences between select on Windows
and on Unix in other areas (on Windows you can only select on sockets)
I'm not sure it's worth trying to fix select if you lose
interruptability; fixing asyncore instead is easy enough, and I don't
think this is going to bite too many other applications.
--Guido van Rossum (home page: http://www.python.org/~guido/)