[PATCH 1 of 4] util: add a simple poll utility

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jun 3 19:54:49 CDT 2015



On 06/03/2015 04:03 PM, Matt Mackall wrote:
> On Wed, 2015-06-03 at 13:26 -0700, Pierre-Yves David wrote:
>> +    if any(sys.maxint <= f for f in fds):
>> +        raise NotImplementedError()
>
> Also, I'm not sure why you're testing against maxint. The actual limit
> is typically something like 2048, defined in FD_SETSIZE. And the reason
> for the limit is that every possible file descriptor up to that limit is
> represented as a bit in the input field. A bit vector with 2^64 bits is
> indeed too large.

Neat, Augie and I were looking for such variable with no luck. Python 
store this in TYPES.FD_SETSIZE. But is also turn out that Python raise a 
ValueError if you give a too large file descriptor to select. So we can 
just catch that. V2 on the way.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list