Make stream_writer optional in ClientResponse.__init__#13051
Open
muhamedfazalps wants to merge 2 commits into
Open
Make stream_writer optional in ClientResponse.__init__#13051muhamedfazalps wants to merge 2 commits into
muhamedfazalps wants to merge 2 commits into
Conversation
Fixes aio-libs#12815 The stream_writer parameter was added as a required keyword argument in aiohttp 3.14.0, breaking backward compatibility with aioresponses and other libraries that create ClientResponse instances directly. This change makes stream_writer optional with a default of None, so existing code that does not pass stream_writer continues to work.
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #13051 +/- ##
=======================================
Coverage 98.96% 98.96%
=======================================
Files 131 131
Lines 48156 48156
Branches 2499 2499
=======================================
Hits 47656 47656
Misses 376 376
Partials 124 124
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 performance
Comparing Footnotes
|
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.
Summary
Make the
stream_writerparameter optional inClientResponse.__init__to preserve backward compatibility.Fixes #12815
Motivation
The
stream_writerparameter was added as a required keyword argument in aiohttp 3.14.0 (PR #12452). This broke backward compatibility withaioresponsesand other libraries that createClientResponseinstances directly:This is a breaking change that should not have been introduced in a minor version bump.
Changes
aiohttp/client_reqrep.py: Changedstream_writer: AbstractStreamWritertostream_writer: AbstractStreamWriter | None = NoneExample
Before (broken):
After (works):
Discovered during open source research. https://buymeacoffee.com/muhamedfazalps