[issue10882] Add os.sendfile()

Giampaolo Rodola' report at bugs.python.org
Wed Feb 9 18:18:27 CET 2011


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

On a second thought I have two complaints.

There is no reason to return the file offset, also because this is only supported on Linux. On all other platforms we are calculating the file offset by making a sum of offset + number of bytes sent. Despite this would normally work it no longer makes sense when headers/trailers arguments are specified.

>>> sendfile(in, out, offset, 4096, headers=[b"xxxx"])
(5000, 5000)

In this case the right offset is supposed to be 4096.
We might adjust this in the code but in my opinion knowing the file offset is not really necessary as what the user really needs is the number of bytes sent, as when using socket.send().

My second complaint is about headers/trailers data type.
Currently we are passing a sequence of buffers (tipically a list) but I think we should pass plain bytes instead.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10882>
_______________________________________


More information about the Python-bugs-list mailing list