Skip to content

Commit 646868a

Browse files
author
Bojan Nikolic
committed
Combine error check into existing ENOSTSOCK check
1 parent ee336eb commit 646868a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Lib/shutil.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,12 @@ def _fastcopy_sendfile(fsrc, fdst):
206206
err.filename = fsrc.name
207207
err.filename2 = fdst.name
208208

209-
if err.errno == errno.ENOTSOCK:
210-
# sendfile() on this platform (probably Linux < 2.6.33)
211-
# does not support copies between regular files (only
212-
# sockets).
213-
_USE_CP_SENDFILE = False
214-
raise _GiveupOnFastCopy(err)
215-
216-
if err.errno == errno.ENODATA:
217-
# In rare cases sendfile() on Linux Lsture call
218-
# returns ENODATA.
209+
if err.errno in (errno.ENOTSOCK, errno.ENODATA):
210+
# ENOTSOCK: sendfile() on this platform (probably
211+
# Linux < 2.6.33) does not support copies between
212+
# regular files (only sockets).
213+
# ENODATA: In rare cases sendfile() on Linux Lustre call
214+
# returns ENODATA
219215
_USE_CP_SENDFILE = False
220216
raise _GiveupOnFastCopy(err)
221217

0 commit comments

Comments
 (0)