Repository navigation
Conversation
On platforms without socket.sendmsg(), such as Windows, _SelectorSocketTransport._write_send() popped the head of the write buffer and dropped it when send() raised BlockingIOError or InterruptedError. writelines() calls _write_ready() right after queueing its data, so calling it while the socket was full lost data. Put the item back at the head of the buffer, as the handler on main does since pythonGH-146518. Make test_write_ready_tryagain compare against an independent buffer, and add a test for writelines() on a full socket.
asvetlov
left a comment
There was a problem hiding this comment.
Bugfix PRs are usually created against the main branch; our bot cherry-picks merged commits to version-specific branch.
Please avoid making pull requests against 3.14 and 3.15 until explicitly requested.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
On platforms without
socket.sendmsg(), such as Windows,_SelectorSocketTransport._write_send()dropped the item it had popped from the write buffer whensend()raisedBlockingIOErrororInterruptedError, sowritelines()on a full socket lost data.This puts the item back at the head of the buffer. It is the
_write_send()handler change that main has had since #146518; the rest of that pull request (the O(1)get_write_buffer_size()) is not included.test_write_ready_tryagaincompared the transport's buffer with itself, so it passed while the item was gone; it now compares against a separate buffer. The newtest_writelines_send_tryagaincoverswritelines()on a full socket. Both tests run_write_send()on a mocked socket, so they run on every platform, and both fail on 3.14 without the fix.