mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-38319: Fix shutil._fastcopy_sendfile(): set sendfile() max block size (GH-16491)
This commit is contained in:
parent
cf57cabef8
commit
94e165096f
3 changed files with 11 additions and 5 deletions
|
@ -356,8 +356,8 @@ class socket(_socket.socket):
|
|||
raise _GiveupOnSendfile(err) # not a regular file
|
||||
if not fsize:
|
||||
return 0 # empty file
|
||||
blocksize = fsize if not count else count
|
||||
|
||||
# Truncate to 1GiB to avoid OverflowError, see bpo-38319.
|
||||
blocksize = min(count or fsize, 2 ** 30)
|
||||
timeout = self.gettimeout()
|
||||
if timeout == 0:
|
||||
raise ValueError("non-blocking sockets are not supported")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue