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
Use the new selectors module in the subprocess module #63123
Comments
Python 3.4 has a new selectors module (issue bpo-16853). It would be nice to use it instead of select.poll or select.select in the subprocess module. |
Other modules using select.select() or select.poll() for more than 1 file descriptor:
|
It's likely that asyncore won't be able to take any practical advantage from this integration. To say one, epoll()/kqueue() pollers won't bring any speedup over select()/poll() because of how asyncore.loop() function is implemented (see http://bugs.python.org/issue6692#msg103628 and http://bugs.python.org/issue11273). Also, the new selectors module only takes read and write events into account, whereas asyncore explicitly closes dispatcher in case of disconnection events (POLLOUT, etc). In summary I'd say it's a lot wiser to leave asyncore alone and consider it frozen. |
Here's a patch updating subprocess to use selectors. |
Here's an updated patch using the new selector.get_map() method. |
Here's an updated patch with a better logic: in the previous version - based on current poll-based implementation, the FD was inferred from the event (i.e. read ready -> stdout/stderr, write ready -> stderr). The new version directly checks the ready file object instead. I also added an extra safety in case an unknown FD is returned (which should never happen). |
subprocess_selectors-3.diff looks good to me (this patch does not I created the issue bpo-19506 for the memoryview optimization. |
New changeset 71b618f0c8e9 by Charles-François Natali in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: