[Python-Dev] Assign to errno allowed?

Thomas Heller thomas.heller@ion-tof.com
Tue, 24 Sep 2002 16:47:17 +0200


From: "Martin v. Loewis" <martin@v.loewis.de>
> "Thomas Heller" <thomas.heller@ion-tof.com> writes:
> 
> > > Are you *sure* about that?
> [...}
> 
> > The select function returns the total number of socket handles that
> > are ready and contained in the fd_set structures, zero if the time
> > limit expired, or SOCKET_ERROR if an error occurred. If the return
> > value is SOCKET_ERROR, WSAGetLastError can be used to retrieve a
> > specific error code.
> 
> This is a strong indication, but not enough for certainty. It does not
> mention errno at all.
> 
Yes.
Here's an experiment (unpatched python):

Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [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: (0, 'Error')
>>>

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')
>>>

Thomas