[Patches] [ python-Patches-611464 ] select problems on Windows

noreply@sourceforge.net noreply@sourceforge.net
Tue, 24 Sep 2002 08:58:36 -0700


Patches item #611464, was opened at 2002-09-19 03:44
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=611464&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Nobody/Anonymous (nobody)
Summary: select problems on Windows

Initial Comment:
On windows, select.select raises select.error(2, 'No 
such file or directory) if called with 3 empty lists.
This is not caught in asyncore's loop.

The attached patch fixes this by simply ignoring the 
exception (2 is ENOENT) in the same way as is done 
for EINTR already.

It may be argued that it would be better to catch this 
exception in the select implementation on Windows 
itself...

IMO this is also a bugfix candidate for 2.2 and 2.1.

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-09-24 11:58

Message:
Logged In: YES 
user_id=6380

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.


----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2002-09-19 15:24

Message:
Logged In: YES 
user_id=11105

I've removed the original patch for asyncore, because it
wasn't correct.

After some reading and thinking, there does not seem to be
an easy way to implement an interruptible select, so I
consider the patch to selectmodule.c complete.

And I changed the title line...


----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2002-09-19 13:24

Message:
Logged In: YES 
user_id=11105

CVS works again, so here is the patch. Fixes the two problems:
bogus error codes, and can be called with empty lists.


----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2002-09-19 11:00

Message:
Logged In: YES 
user_id=11105

Yes, select must be fixed. There is another problem I
noticed in the meantime: the error codes raised by select()
on Windows are bogus, because Windows doesn't set errno, one
must use WSAGetLastError().

I have patched selectmodule.c, but currently I cannot create
a diff because of CVS problems. This patch class Sleep() if
the lists are empty.

It does not interrupt on a signal. This would require the
same code than someone (Mark?) changed recently in
timemodule.c, so that sleep() can be interrupted.

I'm unsure what to do: Leave it uninterruptable, copy the C
code over into selectmodule.c, or PyImport_Import the time
module and use the sleep() function, or whatever.
The function in question is timemodule.c, floatsleep().


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-09-19 04:09

Message:
Logged In: YES 
user_id=21627

I would indeed argue that select should behave uniformly in
this case. On Unix, it blocks until there is a timeout, or
until a signal occurs. Can you come up with a patch that
does the same on Windows?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=611464&group_id=5470