Skip to content

Fix documented default for StreamReader.read_nowait - #13295

Merged
Dreamsorcerer merged 4 commits into
aio-libs:masterfrom
LALITH0110:docs/streamreader-read-nowait-default
Aug 23, 2026
Merged

Dreamsorcerer merged 4 commits into
aio-libs:masterfrom
LALITH0110:docs/streamreader-read-nowait-default

Conversation

@LALITH0110

Copy link
Copy Markdown
Contributor

What do these changes do?

Correct the documented signature of StreamReader.read_nowait in docs/streams.rst.

The reference documented it as read_nowait(n=None), but the real signature in aiohttp/streams.py is def read_nowait(self, n: int = -1). The code even carries a comment recording the change:

def read_nowait(self, n: int = -1) -> bytes:
    # default was changed to be consistent with .read(-1)

The documentation was never updated to follow. Notably the :param int n: description directly below the signature is already correct — it says "-1 for 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

  • I think the code is well written
  • Unit tests for the changes exist — N/A, documentation-only change
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES/ folder

Drafted with Claude Opus 5; reviewed by @LALITH0110.

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.
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.02%. Comparing base (f1c70aa) to head (f9207f1).
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
Autobahn 22.02% <ø> (ø)
CI-GHA 98.93% <ø> (ø)
OS-Linux 98.70% <ø> (+<0.01%) ⬆️
OS-Windows 97.04% <ø> (ø)
OS-macOS 97.94% <ø> (-0.02%) ⬇️
Py-3.10 98.15% <ø> (-0.01%) ⬇️
Py-3.11 98.39% <ø> (+<0.01%) ⬆️
Py-3.12 98.47% <ø> (ø)
Py-3.13 98.47% <ø> (+<0.01%) ⬆️
Py-3.14 98.48% <ø> (-0.01%) ⬇️
Py-3.14t 97.57% <ø> (-0.01%) ⬇️
Py-pypy-3.11 97.43% <ø> (+<0.01%) ⬆️
VM-macos 97.94% <ø> (-0.02%) ⬇️
VM-ubuntu 98.70% <ø> (+<0.01%) ⬆️
VM-windows 97.04% <ø> (ø)
cython-coverage 83.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@codspeed

codspeed Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.27%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 (👁 1) regressed benchmark
✅ 91 untouched benchmarks
⏩ 83 skipped benchmarks1

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

@LALITH0110
LALITH0110 marked this pull request as ready for review August 1, 2026 17:25
@Dreamsorcerer Dreamsorcerer added backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot backport-3.15 Trigger automatic backporting to the 3.15 release branch by Patchback robot labels Aug 23, 2026
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The 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

@Dreamsorcerer
Dreamsorcerer merged commit 2930321 into aio-libs:master Aug 23, 2026
54 checks passed
@patchback

patchback Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport to 3.15: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.15/29303217e0dc5f0bc469833ebed8475c04bf1093/pr-13295

Backported as #13528

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport to 3.14: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.14/29303217e0dc5f0bc469833ebed8475c04bf1093/pr-13295

Backported as #13529

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Dreamsorcerer pushed a commit that referenced this pull request Aug 24, 2026
…Reader.read_nowait (#13528)

**This is a backport of PR #13295 as merged into master
(2930321).**

Co-authored-by: Lalith Kothuru <lalith.kothuru@gmail.com>
Dreamsorcerer pushed a commit that referenced this pull request Aug 24, 2026
…Reader.read_nowait (#13529)

**This is a backport of PR #13295 as merged into master
(2930321).**

Co-authored-by: Lalith Kothuru <lalith.kothuru@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot backport-3.15 Trigger automatic backporting to the 3.15 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants