-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-79698: selector.EpollSelector: add new parameter to support extra events #11193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A documentation update is needed
Lib/selectors.py
Outdated
@@ -348,18 +348,15 @@ def __init__(self): | |||
super().__init__() | |||
self._selector = self._selector_cls() | |||
|
|||
def register(self, fileobj, events, data=None, *, exclusive=False): | |||
def register(self, fileobj, events, data=None, *, extra_events=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra_events=0
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer None
, but no False
plz.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra_events
is a bitmask, why None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra_events
is a bitmask, whyNone
?
In the most circumstance, people do not need the extra_events , so I give it a default value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 0
default value people still don't need to pass extra_events
.
But we don't need to extra check the value for None
, 0
should work fine as no flags for all possible selectors: poll
, epoll
, kqueue
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds a good idea. I will fix it! Thx!
Should |
After this change, we could pass more eventmask in, even wrong ones (not before since only read/write allowed). What to do with them? |
In select module, people use it by passing event mask directly. |
a897190
to
234f30e
Compare
Regarding to check for invalid event mask: the underlying call to |
I commented on the bug tracker. |
@asvetlov It's the current status of
And IMHO, a But it seems it's somewhat messy to implement the check. Relying on the users to always use constants in |
@Zheaoli, would you mind to resolve the conflicts and pull in |
This PR is stale because it has been open for 30 days with no activity. |
bpo-35517: selector.EpollSelector: add new parameter to support EPOLLEXCLUSIVE
https://bugs.python.org/issue35517
https://bugs.python.org/issue35517