Skip to content

Commit

Permalink
[3.11] gh-114077: Fix OverflowError in socket.sendfile() when pass co…
Browse files Browse the repository at this point in the history
…unt >2GiB (GH-114079) (GH-114111)

(cherry picked from commit d4dfad2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
miss-islington and serhiy-storchaka authored Jan 16, 2024
1 parent f5cbed1 commit 0e92265
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def _sendfile_use_sendfile(self, file, offset=0, count=None):
if timeout and not selector_select(timeout):
raise TimeoutError('timed out')
if count:
blocksize = count - total_sent
blocksize = min(count - total_sent, blocksize)
if blocksize <= 0:
break
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix possible :exc:`OverflowError` in :meth:`socket.socket.sendfile` when pass
*count* larger than 2 GiB on 32-bit platform.

0 comments on commit 0e92265

Please sign in to comment.