[New-bugs-announce] [issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector

Nathaniel Smith report at bugs.python.org
Thu Jan 12 18:42:18 EST 2017


New submission from Nathaniel Smith:

If SelectSelector.select() is called when there are no fds registered, then it ends up calling select.select([], [], [], timeout).

On sensible operating systems, this is equivalent to time.sleep(timeout). On Windows, it raises an error. Asyncio manages to avoid hitting this due to the fact that it always has at least one fd registered, but it causes problems for other users of the selectors module, e.g.:
  https://github.com/dabeaz/curio/issues/75

I see two possible approaches to fixing this:

1) Modify SelectSelector to check for this case and call time.sleep() instead of select.select() when encountered.

2) Modify the select.select() wrapper so that it behaves consistently on all operating systems, by special-casing this situation on Windows.

Option (2) seems nicer to me.

----------
components: Library (Lib)
messages: 285353
nosy: njs
priority: normal
severity: normal
status: open
title: Windows select() errors out when given no fds to select on, which breaks SelectSelector
versions: Python 3.5, Python 3.6, Python 3.7

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


More information about the New-bugs-announce mailing list