-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
Add method send_io, recv_io to the socket module. #72910
Comments
This patch makes it easy to pass file descriptor in using AF_UNIX. Ruby language libraries have such methods. see slso: |
Hi, thanks for your contribution! Documentation give examples implementation of your methods:
and from here, some remarks:
Adding those methods may make sense if people are copying send_fds/recv_fds in their code, but I found only two copy/paste in github, so I think the best is to put your code as a module on pypi and see, from here, if it gets popular? You should also write a few tests, and comply to the PEP-8 (your two methods should probably be separated by a newline). Bests |
FYI, multiprocessing.reduction module has send_fds and recv_fds. |
Unless somebody don't think so, I think this should go as a pypi module before going to the socket module, so this issue should probably be closed. |
Good idea! Initially I planned to add the functions and some other helpers around AF_UNIX to Python 3.6. You can directly copy the example functions from the documentation. https://docs.python.org/3/library/socket.html#socket.socket.sendmsg Please keep the names send_fds() and recv_fds(), and pass the message like in the examples. Some protocols use the payload to signal the count of fds. Your patch is also lacking unit tests and documentation update. |
Thanks for reviews and comments. I will work on the weekend. |
Take your time, feature freeze for 3.7 is in about 18 months from now. |
See also bpo-37385: "test_multiprocessing fails on AMD64 FreeBSD CURRENT Shared 2.7". |
Thanks Shinya Okano for the original patch. Well done Joannah! Thanks for your tenacity :-) This PR has 100 comments and 27 commits which shows the complexity of the feature. Honestly, I'm not 100% happy with current documentation, but I chose to merge the PR anyway. Please leave this issue open until the documentation is completed to mention corner cases like partial send (similar to sock.send vs sock.sendall). |
I was looking at adding stubs for these to typeshed. Is it intentional that we ignore the flags and address arguments in the implementation? |
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: