[issue25680] Selector.select() hangs when there is nothing to select

Guido van Rossum report at bugs.python.org
Sun Nov 22 18:01:15 EST 2015


Guido van Rossum added the comment:

I don't think we should "fix" the select module; it's advertised as a wrapper around the various syscalls, and if the platforms disagree on what that syscall (e.g. select()) does we shouldn't try to fix it. (Documenting the differences is fine.)

However the *selectors* module is a different thing. It defines a better abstraction that's supposedly independent from the underlying syscall. I agree with Aleksey that it should just hang when no FDs are registered and no timeout is given -- this is the only logical extension of its behavior when a FD is registered or a timeout is given. This could be used to wait until e.g. a signal arrives.

It's illogical that it would behave differently if a FD was registered that will never fire, or if a timeout of a billion seconds was given (although that may be an easy hack to wait forever if the underlying syscall doesn't like this).

The asyncio package would probably be broken because of this except that it always has a FD registered (the self-pipe).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25680>
_______________________________________


More information about the Python-bugs-list mailing list