summaryrefslogtreecommitdiff
path: root/Lib/socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socket.py')
-rwxr-xr-xLib/socket.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index e5989d9dfd..84a5dcb0da 100755
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -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")