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 <rep...@bugs.python.org>
<http://bugs.python.org/issue29256>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to