Giampaolo Rodola' <g.rod...@gmail.com> added the comment:
I took a look at your PR. As the PR currently stands it only works with epoll() selector. For the other selectors this is just an extra argument which does nothing, so it complicates the API of 2 methods for no real gain. Also, a single argument is not compatible with kqueue() because kqueue() requires two distinct `KQ_FILTER_*` and `KQ_EV_*` constants which cannot be ORed together. Instead, I think simply turning the underlying selector instance into a public property is more flexible and less complex. On Linux you'll do: >>> s = selectors.EpollSelector() >>> s.register(fd, EVENT_READ) >>> s.selector.modify(fd, select.EPOLLEXCLUSIVE) ``` ...and on BSD: >>> s = selectors.KqueueSelector() >>> s.register(fd, EVENT_READ) >>> k = s.selector.kevent(fd, select.KQ_FILTER_READ, select.KQ_EV_CLEAR) >>> s.selector.control([k], 0, 0) ``` Alternatively we could just keep `DefaultSelector._selector` private and document it. Personally I'd also be OK with that even though I'm not sure if there if there are precedents of documenting private APIs. ---------- nosy: +asvetlov, gvanrossum _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35517> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com