Skip to content

Commit

Permalink
Fix 32bit asyncio sendfile (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Jun 22, 2023
1 parent 6c08afa commit 27e7c9e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions python/3.11/asynctio_unix_events.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index f34a5b4b44..b1d0f1e61e 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -369,6 +369,11 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
fut.set_result(total_sent)
return

+ # On 32-bit architectures truncate to 1GiB to avoid OverflowError,
+ # see bpo-38319.
+ if sys.maxsize < 2 ** 32:
+ blocksize = min(blocksize, 2 ** 30)
+
try:
sent = os.sendfile(fd, fileno, offset, blocksize)
except (BlockingIOError, InterruptedError):

0 comments on commit 27e7c9e

Please sign in to comment.