Serhiy Storchaka added the comment: This issue can be tested without moking os.fstat():
class F: def fileno(self): return fd with socket.socket() as sock: fd = os.open(os.curdir, os.O_RDONLY) os.close(fd) self.assertRaises(socket._GiveupOnSendfile, sock._sendfile_use_sendfile, F()) os.fstat() can raise not only OSError. It may be worth to test also with fd = 2**1000 and fd = None. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26384> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com