Skip to content

Commit 44c0184

Browse files
author
Bojan Nikolic
committed
Pull comment on seekability ahead of dstpos lseek
1 parent f59253b commit 44c0184

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/shutil.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,15 @@ def _fastcopy_sendfile(fsrc, fdst):
218218
# ENODATA.
219219
_USE_CP_SENDFILE = False
220220

221+
# 'infd' and 'outfd' are assumed to be seekable, as
222+
# they are checked to be "regular" files.
221223
dstpos = os.lseek(outfd, 0, os.SEEK_CUR)
222224
if dstpos > 0:
223225
# Some data has already been written but we use
224226
# sendfile in a mode that does not update the
225227
# input fd position when reading. Hence seek the
226228
# input fd to the correct position before falling
227-
# back on POSIX read/write method. Since sendfile
228-
# requires mmapable infd, it should also be seekable
229+
# back on POSIX read/write method.
229230
os.lseek(infd, dstpos, os.SEEK_SET)
230231

231232
raise _GiveupOnFastCopy(err)

0 commit comments

Comments
 (0)