]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131325: fix sendfile fallback implementation to drain data after writing to transp...
authorKumar Aditya <kumaraditya@python.org>
Mon, 17 Mar 2025 19:22:57 +0000 (00:52 +0530)
committerGitHub <noreply@github.com>
Mon, 17 Mar 2025 19:22:57 +0000 (00:52 +0530)
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 546361f80b1f4766a12802ceec62696586641ed2..ff63639638c13fd550f1f5192164ffe256e3be55 100644 (file)
@@ -1295,8 +1295,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`.