From 47233ca0703e8e21e4d8470fa339830f78fb3b65 Mon Sep 17 00:00:00 2001 From: Prakash Sellathurai Date: Wed, 24 Jun 2026 21:26:31 +0530 Subject: [PATCH 1/3] Use 256 KiB chunksize in _sendfile_fallback Signed-off-by: Prakash Sellathurai --- Lib/asyncio/base_events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index e6c72e3d5b5487..bb736222b0b386 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) From 0385f87a0d6477828e8ca32fd16d9bd433e92ebd Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 24 Jun 2026 16:08:46 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst 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 00000000000000..3f8206a7525ae8 --- /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` From b2861917645166e3d6c1989133ced5a53691f2b7 Mon Sep 17 00:00:00 2001 From: Prakash Sellathurai Date: Wed, 24 Jun 2026 22:14:58 +0530 Subject: [PATCH 3/3] typo Signed-off-by: Prakash Sellathurai --- .../next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 3f8206a7525ae8..05e61670582dd8 100644 --- 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 @@ -1 +1 @@ -Increase the buffer size to 256 KiB in :meth:`asyncio.loop.sendfile` method fallback` +Increase the buffer size to 256 KiB in :meth:`asyncio.loop.sendfile` method fallback.