[New-bugs-announce] [issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector
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.:
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)
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>
More information about the New-bugs-announce