Repository navigation
Conversation
Automation signalsActivity patterns show signs of automation. Evidence
Last 2 PRs: This is an automated analysis by AgentScan |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #14327 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 135 135
Lines 53439 53494 +55
Branches 2723 2728 +5
=======================================
+ Hits 52967 53022 +55
Misses 358 358
Partials 114 114
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
|
CI is now passing except for “Backport label added”. The affected code exists in both 3.14 and 3.15. Could a maintainer add the appropriate backport labels? I don’t have permission to set upstream labels. |
What do these changes do?
Fix direct stream writes of C-contiguous memoryviews.
write()now checks dimensions and element size without callinglen()on scalar views.write_eof()performs the same byte-view normalization before framing or transport writes, and usesnbytesfor progress accounting. Empty multidimensional views become an empty chunk without attempting an invalid cast.For example, an 8-byte view cast to
Hpreviously produced a final HTTP chunk advertised as 4 bytes, which the client rejected. It now produces an 8-byte chunk containing the original bytes. Scalar views no longer raiseTypeError.Are there changes in behavior for the user?
Direct
StreamResponsewrites send the raw buffer bytes independently of element size and shape. The writer preserves the original view for the chunk callback, and casts nonempty contiguous views without copying. This is separate from #14019'sBytesPayloadchange: the new HTTP tests useStreamResponsedirectly.Is it a substantial burden for the maintainers to support this?
The change extends the existing normalization in the writer to its final-chunk path, with focused regressions and a short reference-doc update. It adds no dependency or public API.
Related issue number
Fixes #14326.
Checklist
0718loltoCONTRIBUTORS.txtin sorted order (the account has no public full name).CHANGES/.Local validation
Base:
8f51d5be21bbd021160079d9d6dae739814bd0cf. macOS arm64, CPython 3.12.15, pure Python mode.The same 38 regression cases produced 19 failures / 19 passes with baseline production code and 38 passes with the fix. They cover chunk framing with buffered and unbuffered headers, output/progress byte counts, callback inputs, byte limits, and 12 real HTTP round trips with and without compression.
All applicable repository pre-commit hooks passed, as did
git diff --check. The full repository suite, other interpreters, and compiled extensions were not run. No parser or WebSocket code changes are included.Drafted with OpenAI Codex (GPT-6); human review by 0718lol pending. This PR remains a draft until that review occurs, as required by
AGENTS.md.