New submission from Alexey Poryadin:

When is called `select`, but registered no one `fileobject` rise exception:
...
    polled = self._selector.select(timeout)
  File "/usr/lib/python3.4/selectors.py", line 424, in select
    fd_event_list = self._epoll.poll(timeout, max_ev)
ValueError: maxevents must be greater than 0, got 0

Of course, it makes no sense to call `select` if there is nothing to watch. But 
"select.epol.poll" is not raises exception in the same case if `max_ev`=-1. And 
this simplifies the application code and is useful if need just sleep for a 
timeout.

So, I suggest a small fix:
-    fd_event_list = self._epoll.poll(timeout, max_ev)
+    fd_event_list = self._epoll.poll(timeout, max_ev or -1)

----------
messages: 232300
nosy: Alexey.Poryadin
priority: normal
severity: normal
status: open
title: selectors.EpollSelector.select raises exception when nothing to select.
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to