[Python-Dev] FW: [Python-Help] Python threads with suncc (Forte 6.1) compiler
Guido van Rossum
guido@zope.com
Sat, 04 Aug 2001 02:29:08 -0400
> Some Socket Wizard should worry about the attached. What's life like on
> 64-bit Linux (etc)?
Dunno, but I doubt 64-bit Linux would be so dumb as to declare
FD_SETSIZE to be 2**16.
> Perhaps more autoconf crap could fudge this.
I think we can avoid this.
> once-again-windows-shows-the-way<wink>-ly y'rs - tim
Yes, in a very simple way: instead of testing for MS_WINDOWS, we could
test for a preposterous value of FD_SETSIZE. For example, change all
three occurrences of
#ifdef MS_WINDOWS
into
#if FD_SETSIZE > 1024
Looking at the code, a better solution may be to always allocate this
thing on the heap, and to let list2set allocate it. The actual number
of items *used* is the length of the list of file descriptors + 1 (a
sentinel). Even if FD_SETSIZE is not preposterous, the array size
allocated is the theoretical maximum, which is always ways larger than
the size needed. (I also fail to understand why 3 extra elements are
allocated; the algorithm seems to need only one extra.)
Yet another approach would (shrudder :) be to forget about arrays and
use a Python dict, since that's the usage: the data structure stores
the mapping between file descriptors (unique small ints) and objects
in the argument lists (either Python ints or objects with a fileno()
method).
Volunteers? Not me! :)
--Guido van Rossum (home page: http://www.python.org/~guido/)