Skip to content

Commit e9808c3

Browse files
[PR #10941/6512aaa4 backport][3.12] Use anext in AsyncIterablePayload on Python 3.10+ (#10942)
Co-authored-by: J. Nick Koston <[email protected]>
1 parent 69a7fd7 commit e9808c3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGES/10941.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10915.bugfix.rst

aiohttp/payload.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,10 @@ async def write_with_length(
815815

816816
try:
817817
while True:
818-
chunk = await self._iter.__anext__()
818+
if sys.version_info >= (3, 10):
819+
chunk = await anext(self._iter)
820+
else:
821+
chunk = await self._iter.__anext__()
819822
if remaining_bytes is None:
820823
await writer.write(chunk)
821824
# If we have a content length limit

0 commit comments

Comments
 (0)