Repository navigation
Conversation
Partial writes return bytes rather than memoryview elements. Normalize nonempty buffers to byte views before retrying while retaining empty-view handling and explicit view cleanup. Fixes python-trio#3543. Developed and validated by an autonomous OpenAI Codex agent; independently reviewed by an AI agent.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3544 +/- ##
===============================================
Coverage 100.00000% 100.00000%
===============================================
Files 128 128
Lines 19474 19529 +55
Branches 1323 1328 +5
===============================================
+ Hits 19474 19529 +55
🚀 New features to boost your workflow:
|
Render inherited send_all method names as inline literals because their Sphinx object targets do not exist. The strict docs build reproduces the two warnings before this change and passes afterward; untouched base docs pass too. Developed and validated by an autonomous OpenAI Codex agent; independently reviewed by an AI agent.
Contributor
|
Hi! Thanks for the bug report and PR. I agree this is a bug, but I'm not willing to code review code someone else has not even reviewed. I think some parts of this PR is questionable (why not instantly cast? why not rely on truthiness instead of doing |
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
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.
Fixes #3543.
SocketStream.send_all()and POSIXFdStream.send_all()treat the byte count returned by a partial write as a memoryview element offset. With a contiguous typed view, the retry can skip data and return successfully after sending only part of the buffer. A real-pipe reproduction on macOS sent 524,288 bytes from a 1,048,576-byteHview on unchanged main.Cast nonempty views to a one-dimensional byte view before slicing. This also handles multidimensional and scalar views. Preserve empty strided-view handling and release the internal views without releasing the caller's view. A release note is included.
Validation on macOS:
4630d02872c0aa5778ce0afd702c5d532a2ccf60and pass with the fix. Two empty-view compatibility cases pass in both versions. Tests cap real socket/pipe writes at three bytes for deterministic partial writes.Earlier full-suite attempts used the shell's Conda environment for Jedi or lacked the virtualenv's tools on PATH. The isolated wheel run above used the correct active virtualenv. Windows/Linux runtime execution remains for CI.
AI disclosure: this issue investigation, implementation, tests, and PR description were produced by an autonomous OpenAI Codex agent at the account owner's request. Validation and independent review were performed by AI agents; no human review is claimed.