Repository navigation
Fix documented default for StreamReader.read_nowait - #13295
Dreamsorcerer merged 4 commits into
Conversation
The reference documented the signature as `read_nowait(n=None)`, but the default has been `-1` for some time; `aiohttp/streams.py` carries a comment noting the default was changed to be consistent with `.read(-1)`. The parameter description just below already documented `-1` as the value that reads the whole internal buffer, so only the signature was stale.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13295 +/- ##
=======================================
Coverage 99.02% 99.02%
=======================================
Files 135 135
Lines 49992 49992
Branches 2597 2597
=======================================
Hits 49507 49507
Misses 366 366
Partials 119 119
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 degrade performance by 10.27%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| 👁 | test_read_base64_part |
15.5 ms | 17.3 ms | -10.27% |
Comparing LALITH0110:docs/streamreader-read-nowait-default (f9207f1) with master (f1c70aa)
Footnotes
-
83 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Confidence Score: 5/5The documentation-only correction appears safe to merge. The updated signature matches the existing implementation and parameter description, and the changelog fragment follows repository conventions. Reviews (1): Last reviewed commit: "Merge branch 'master' into docs/streamre..." | Re-trigger Greptile |
Backport to 3.15: 💚 backport PR created✅ Backport PR branch: Backported as #13528 🤖 @patchback |
Backport to 3.14: 💚 backport PR created✅ Backport PR branch: Backported as #13529 🤖 @patchback |
What do these changes do?
Correct the documented signature of
StreamReader.read_nowaitindocs/streams.rst.The reference documented it as
read_nowait(n=None), but the real signature inaiohttp/streams.pyisdef read_nowait(self, n: int = -1). The code even carries a comment recording the change:The documentation was never updated to follow. Notably the
:param int n:description directly below the signature is already correct — it says "-1for the whole internal buffer" — so the signature line was the only stale part, and it contradicted the prose sitting three lines under it.One line changed. Documentation only, no code changes.
Are there changes in behavior for the user?
No. Nothing in the library changes. The reference now shows the default the method actually has, and no longer contradicts its own parameter description.
Is it a substantial burden for the maintainers to support this?
No. One-line documentation correction with no ongoing maintenance cost.
Related issue number
None — found while comparing documented parameter defaults against the real signatures.
Checklist
CONTRIBUTORS.txtCHANGES/folderDrafted with Claude Opus 5; reviewed by @LALITH0110.