]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-131325: fix sendfile fallback implementation to drain data after writing...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 17 Mar 2025 19:46:30 +0000 (20:46 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Mar 2025 19:46:30 +0000 (19:46 +0000)
gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376)
(cherry picked from commit 94f4d87aeb4d2d7bddcb4c3aad4f62a727ac91ee)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Lib/asyncio/base_events.py
Misc/NEWS.d/next/Library/2025-03-17-18-50-39.gh-issue-131325.wlasMF.rst [new file with mode: 0644]

index e19a364886ab5f36657b3b72a7e9a9896111794b..d6f98370fd23e1068ea45e7273b9fcda6cfda192 100644 (file)
@@ -1292,8 +1292,8 @@ class BaseEventLoop(events.AbstractEventLoop):
                 read = await self.run_in_executor(None, file.readinto, view)
                 if not read:
                     return total_sent  # EOF
-                await proto.drain()
                 transp.write(view[:read])
+                await proto.drain()
                 total_sent += read
         finally:
             if total_sent > 0 and hasattr(file, 'seek'):
diff --git a/Misc/NEWS.d/next/Library/2025-03-17-18-50-39.gh-issue-131325.wlasMF.rst b/Misc/NEWS.d/next/Library/2025-03-17-18-50-39.gh-issue-131325.wlasMF.rst
new file mode 100644 (file)
index 0000000..6c1f64e
--- /dev/null
@@ -0,0 +1 @@
+Fix sendfile fallback implementation to drain data after writing to transport in :mod:`asyncio`.