-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch asyncio.unix_events for bpo-38319 (#97)
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 1ff8c427da..0e8eb719ed 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |