Skip to content

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

Open
alex-feel wants to merge 1 commit into
python:mainfrom
alex-feel:main-selector-write-send-test
Open

alex-feel wants to merge 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

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants