]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-152074: Increase the buffer size to 256 KiB in `asyncio` `_sendfile_fallback...
authorPrakash Sellathurai <prakashsellathurai@gmail.com>
Sun, 28 Jun 2026 10:17:49 +0000 (15:47 +0530)
committerGitHub <noreply@github.com>
Sun, 28 Jun 2026 10:17:49 +0000 (15:47 +0530)
Lib/asyncio/base_events.py
Misc/NEWS.d/next/Library/2026-06-24-16-08-44.gh-issue-152074.PsbS-I.rst [new file with mode: 0644]

index e6c72e3d5b5487ea59a077cf98f5a8b98e431efb..bb736222b0b386617bf308fa05924892d8bb354e 100644 (file)
@@ -1296,7 +1296,10 @@ class BaseEventLoop(events.AbstractEventLoop):
     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 (file)
index 0000000..05e6167
--- /dev/null
@@ -0,0 +1 @@
+Increase the buffer size to 256 KiB in :meth:`asyncio.loop.sendfile` method fallback.