This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: select problems on Windows
Type: Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: gvanrossum, loewis, theller
Priority: normal Keywords: patch

Created on 2002-09-19 07:44 by theller, last changed 2022-04-10 16:05 by admin. This issue is now closed.

File name Uploaded Description Edit
selectmodule.c.diff theller, 2002-09-19 17:24 Patch for selectmodule.c
Messages (7)
msg41163 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-09-19 07:44
On windows, 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 

IMO this is also a bugfix candidate for 2.2 and 2.1.
msg41164 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-19 08:09
Logged In: YES 

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?
msg41165 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-09-19 15:00
Logged In: YES 

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().
msg41166 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-09-19 17:24
Logged In: YES 

CVS works again, so here is the patch. Fixes the two problems:
bogus error codes, and can be called with empty lists.
msg41167 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-09-19 19:24
Logged In: YES 

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...
msg41168 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-09-24 15:58
Logged In: YES 

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.
msg41169 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-09-24 17:32
Logged In: YES 

Fixed., rev 1.36
selectmodule.c, rev 1.70
Date User Action Args
2022-04-10 16:05:41adminsetgithub: 37195
2002-09-19 07:44:44thellercreate