https://github.com/python/cpython/commit/e3ba57b3031f81bc9131d5bcf29b2edcfc770317
commit: e3ba57b3031f81bc9131d5bcf29b2edcfc770317
branch: main
author: Prakash Sellathurai <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-06-28T15:47:49+05:30
summary:
gh-152074: Increase the buffer size to 256 KiB in `asyncio`
`_sendfile_fallback` (#152097)
files:
A Misc/NEWS.d/next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst
M Lib/asyncio/base_events.py
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index e6c72e3d5b5487e..bb736222b0b3866 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -1296,7 +1296,10 @@ async def _sendfile_native(self, transp, file, offset,
count):
async def _sendfile_fallback(self, transp, file, offset, count):
if hasattr(file, 'seek'):
file.seek(offset)
- blocksize = min(count, 16384) if count else 16384
+ blocksize = (
+ min(count, constants.SENDFILE_FALLBACK_READBUFFER_SIZE)
+ if count else constants.SENDFILE_FALLBACK_READBUFFER_SIZE
+ )
buf = bytearray(blocksize)
total_sent = 0
proto = _SendfileFallbackProtocol(transp)
diff --git
a/Misc/NEWS.d/next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst
b/Misc/NEWS.d/next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst
new file mode 100644
index 000000000000000..05e61670582dd8b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst
@@ -0,0 +1 @@
+Increase the buffer size to 256 KiB in :meth:`asyncio.loop.sendfile` method
fallback.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]