[Python-Dev] Assign to errno allowed?
Thomas Heller
thomas.heller@ion-tof.com
Tue, 24 Sep 2002 17:15:04 +0200
> > Patched python:
> >
> > Python 2.3a0 (#29, Sep 19 2002, 12:38:34) [MSC 32 bit (Intel)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import select
> > >>> select.select([], [], [], 10)
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > select.error: (10093, 'Either the application has not called WSAStartup, or WSAStartup failed')
> > >>> import socket
> > >>> select.select([], [], [], 10)
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > select.error: (10022, 'An invalid argument was supplied')
> > >>>
>
> Hm... I can confirm this on my Win98SE box. But questions pop up:
>
> Why is the error different the first time? And why is this an
> error at all?
The winsock library is not initialized the first time - it seems
that socketmodule calls WSAStartup(), but I haven't looked at
this in detail.
Also I think it's not worth to fix it, there's no use for select()
on windows if you don't use sockets - you have to supply at least
one socket descriptor (that's the cause for the second error above).
Although it could be argued whether it makes sense to simulate
a Linux-compatible select for Windows.
> On Linux, this is not an error. (In fact, time.sleep()
> uses this to sleep using subsecond precision.)
>From my early Unix (actually Minix) experiments I remember
that select(3) was the only possibility to do subsecond delays
in Unix. Is this still the same today?
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
And yes, I will fix it in 2.3 and backport it to 2.2.2.
Thomas