This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author njs
Recipients njs
Date 2017-01-12.23:35:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When calling kevent(), sets the "maxevents" argument to len(self._fd_to_key). So if there are no fds registered, it passes maxevents=0.

It turns out that the kevent() API has a special case behavior for maxevents=0: it returns immediately, ignoring timeout. I have no idea why kevent() works this way, but it's specifically called out in the man page:

   The nevents argument determines the size of eventlist.  When
   nevents is zero, kevent() will return immediately even if there is a
   timeout specified unlike select(2).

It happens that asyncio doesn't run into this because asyncio always has at least one fd registered with its selector, but this causes problems for other users of the selectors module, e.g.:

I believe fix would just be to add some code like: "if max_ev == 0: max_ev = 1" to
Date User Action Args
2017-01-12 23:35:07njssetrecipients: + njs
2017-01-12 23:35:07njssetmessageid: <>
2017-01-12 23:35:06njslinkissue29255 messages
2017-01-12 23:35:04njscreate