This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author anacrolix
Recipients anacrolix, giampaolo.rodola, loewis, pitrou, rosslagerwall
Date 2011-01-29.00:03:53
SpamBayes Score 1.9580615e-11
Marked as misclassified No
Message-id <1296259434.91.0.805673790577.issue10882@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011-01-29 00:03:54anacrolixsetrecipients: + anacrolix, loewis, pitrou, giampaolo.rodola, rosslagerwall
2011-01-29 00:03:54anacrolixsetmessageid: <1296259434.91.0.805673790577.issue10882@psf.upfronthosting.co.za>
2011-01-29 00:03:53anacrolixlinkissue10882 messages
2011-01-29 00:03:53anacrolixcreate