-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-107898 socket.send_fds and socket.recv_fds honour optional arguments.
#108243
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
Open
miccoli
wants to merge
10
commits into
python:main
Choose a base branch
from
miccoli:fix-issue-107898
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class SendRecvFdsTests is refactored to test also the optional parameters of recv_fds and send_fds. Methods - testSendAndRecvFds: base check, semantically equivalent to legacy version, changes are only for legibility and code reuse in following tests. - testRecvFlags: new test in which the socket.MSG_PEEK flag is passed to recv_fds. socket.MSG_PEEK semantics is checked. - testSendAddress: new test in which the address parameter of send_fds is tested on a connectionless socket of type SOCK_DGRAM There are no tests for the flags of send_fds, because testing MSG_OOB would be way too complicated.
…ecv_fds Optional parameters (flags and adress) are passed to undelying sendmsg and recvmsg functions. Minor code formatting for legibility.
An inconclusive sentence is dropped: the code should be able to handle truncated integers at the end of cmsg_data, no need to alert the user.
2 tasks
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
When receiving fds with the MSG_PEEK flag, two cases may arise. 1. The incoming msg has msg_flags == 0 and ancillary data contains open fd's (seen on linux); 2. msg_flags == MSG_PEEK and ancillary data contains a null array (seen on darwin).
|
Sorry for the messy PR... I should have tested also in a linux container and not only on macOS. This is my first PR in cpython, please let me know if I should rebase and force-push or leave it with the many attemps. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extends the test suite for failing due to gh-107898, and implements the trivial fixes in
Lib/socket.py.New checks:
MSG_PEEKflag insocket.recv_fdsSOCK_DGRAMsockets with theaddressparameter issocket.send_fdsA minor correction is done to the docs.
📚 Documentation preview 📚: https://cpython-previews--108243.org.readthedocs.build/