gh-114077: Fix OverflowError in socket.sendfile() when pass count >2GiB (GH-114079)

This commit is contained in:
Serhiy Storchaka 2024-01-16 13:31:34 +02:00 committed by GitHub
parent c85c0026a6
commit d4dfad2aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -382,7 +382,7 @@ class socket(_socket.socket):
if timeout and not selector_select(timeout): if timeout and not selector_select(timeout):
raise TimeoutError('timed out') raise TimeoutError('timed out')
if count: if count:
blocksize = count - total_sent blocksize = min(count - total_sent, blocksize)
if blocksize <= 0: if blocksize <= 0:
break break
try: try:

View File

@ -0,0 +1,2 @@
Fix possible :exc:`OverflowError` in :meth:`socket.socket.sendfile` when pass
*count* larger than 2 GiB on 32-bit platform.