Matt Joiner <anacro...@gmail.com> added the comment:

I have a few problems with these parts of the latest patch:

+   The second case may be used on Mac OS X and FreeBSD where *headers*
+   and *trailers* are arbitrary sequences of buffers that are written before 
and
+   after the data from *in* is written. It returns the same as the first case.

Why special case these? Why can't Mac OS X and FreeBSD write those manually 
into the output file descriptor. It's presumptious but I don't see why 
something so easy to do explicitly is mashed into the interface here, just 
pretend it doesn't exist. For the sake of simplicity (and sendfile might become 
very popular in future code), just drop this "feature".

for h in headers: out.write(h)
os.sendfile(out, in, offset, count)
for t in trailers: out.write(t)

+   On Mac OS X and FreeBSD, a value of 0 for *count* specifies to send until
+   the end of *in* is reached.

Again this should be emulated where it's not available, as it's very common, 
and a logical feature to have. However as indicated earlier, if os.sendfile is 
a minimal syscall wrapper, some thought needs to be given to a "higher-level" 
function, that also includes my other suggestions.

+   On Solaris, *out* may be the file descriptor of a regular file or the file
+   descriptor of a socket. On all other platforms, *out* must be the file
+   descriptor of an open socket

I'm pretty sure that Solaris isn't the only platform that supports non-socket 
file descriptors here, Linux (the platform I'm using), is one such case. As a 
general rule, we want to allow any file descriptors, and not restrict to 
sockets (except for awful platforms like Windows).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10882>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to