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 giampaolo.rodola
Recipients Manjusaka, asvetlov, giampaolo.rodola, gvanrossum, neologix, vstinner, yselivanov
Date 2018-12-17.18:48:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1545072525.61.0.788709270274.issue35517@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-12-17 18:48:45giampaolo.rodolasetrecipients: + giampaolo.rodola, gvanrossum, vstinner, asvetlov, neologix, yselivanov, Manjusaka
2018-12-17 18:48:45giampaolo.rodolasetmessageid: <1545072525.61.0.788709270274.issue35517@psf.upfronthosting.co.za>
2018-12-17 18:48:45giampaolo.rodolalinkissue35517 messages
2018-12-17 18:48:45giampaolo.rodolacreate