Skip to content

gh-162610: Test that the asyncio selector transport keeps data on a blocked send - #162612

Merged
kumaraditya303 merged 1 commit into
python:mainfrom
alex-feel:main-selector-write-send-test
Nov 27, 2026
Merged

kumaraditya303 merged 1 commit into
python:mainfrom
alex-feel:main-selector-write-send-test

Conversation

@alex-feel

@alex-feel alex-feel commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

#146518 fixed _SelectorSocketTransport._write_send() dropping the item it had popped from the write buffer when send() raised BlockingIOError, but no test caught the drop: test_write_ready_tryagain compared the transport's buffer with itself.

It now compares against a separate buffer and checks get_write_buffer_size(), and the new test_writelines_send_tryagain covers writelines() on a full socket. Both fail if the handler goes back to pass. Both run _write_send() on a mocked socket, so they cover the Windows code path on every platform.

Tests only, so there is no NEWS entry.

test_write_ready_tryagain compared the transport's buffer with itself, so it could not detect a dropped item.
Compare against an independent buffer and the buffer size, and add a test for writelines() on a full socket.
@python-cla-bot

python-cla-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Nov 25, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@kumaraditya303
kumaraditya303 merged commit 62b809d into python:main Nov 27, 2026
67 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @alex-feel for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 27, 2026

Copy link
Copy Markdown

GH-162751 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 27, 2026
kumaraditya303 pushed a commit that referenced this pull request Nov 27, 2026
… on a blocked send (GH-162612) (#162751)

gh-162610: Test that the asyncio selector transport keeps data on a blocked send (GH-162612)
(cherry picked from commit 62b809d)

Co-authored-by: Aleksandr Filippov <71711753+alex-feel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir topic-asyncio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants