Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
94e16509
Commit
94e16509
authored
Oct 01, 2019
by
Giampaolo Rodola
Committed by
GitHub
Oct 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-38319: Fix shutil._fastcopy_sendfile(): set sendfile() max block size (GH-16491)
parent
cf57cabe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
Lib/shutil.py
Lib/shutil.py
+7
-3
Lib/socket.py
Lib/socket.py
+2
-2
Misc/NEWS.d/next/Library/2019-09-30-22-06-33.bpo-38319.5QjiDa.rst
...S.d/next/Library/2019-09-30-22-06-33.bpo-38319.5QjiDa.rst
+2
-0
No files found.
Lib/shutil.py
View file @
94e16509
...
...
@@ -135,9 +135,13 @@ def _fastcopy_sendfile(fsrc, fdst):
# should not make any difference, also in case the file content
# changes while being copied.
try
:
blocksize
=
max
(
os
.
fstat
(
infd
).
st_size
,
2
**
23
)
# min 8MB
except
Exception
:
blocksize
=
2
**
27
# 128MB
blocksize
=
max
(
os
.
fstat
(
infd
).
st_size
,
2
**
23
)
# min 8MiB
except
OSError
:
blocksize
=
2
**
27
# 128MiB
# On 32-bit architectures truncate to 1GiB to avoid OverflowError,
# see bpo-38319.
if
sys
.
maxsize
<
2
**
32
:
blocksize
=
min
(
blocksize
,
2
**
30
)
offset
=
0
while
True
:
...
...
Lib/socket.py
View file @
94e16509
...
...
@@ -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"
)
...
...
Misc/NEWS.d/next/Library/2019-09-30-22-06-33.bpo-38319.5QjiDa.rst
0 → 100644
View file @
94e16509
sendfile() used in socket and shutil modules was raising OverflowError for
files >= 2GiB on 32-bit architectures. (patch by Giampaolo Rodola)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment