mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
gh-82500: Fix asyncio sendfile overflow on 32bit (#107056)
This commit is contained in:
parent
7fc9be350a
commit
9eeb4b485f
2 changed files with 4 additions and 0 deletions
|
|
@ -394,6 +394,9 @@ def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
|
|||
fut.set_result(total_sent)
|
||||
return
|
||||
|
||||
# On 32-bit architectures truncate to 1GiB to avoid OverflowError
|
||||
blocksize = min(blocksize, sys.maxsize//2 + 1)
|
||||
|
||||
try:
|
||||
sent = os.sendfile(fd, fileno, offset, blocksize)
|
||||
except (BlockingIOError, InterruptedError):
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Fix overflow on 32-bit systems with :mod:`asyncio` :func:`os.sendfile` implemention.
|
||||
Loading…
Add table
Add a link
Reference in a new issue