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 giampaolo.rodola
Recipients akira, asvetlov, christian.heimes, giampaolo.rodola, josh.r, neologix, pitrou, rosslagerwall
Date 2014-04-22.02:13:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398132801.2.0.998358929348.issue17552@psf.upfronthosting.co.za>
In-reply-to
Content
> Instead of returning [...] you could specify `no_fallback=False` that 
> could be set to `True` to assert that the fallback is not used
> [...] and return the number of bytes sent.

Good idea, thanks, that is much better indeed. Updated patch is in attachment.


> [...] file.tell() may be changed by something else that uses 
> the same file descriptor? What happens if the file grows?

I would say that is a use case we should explicitly not support as it probably implies you're doing something you're not supposed to. 


> If possible always include the number of bytes sent in any error that is raised.

That's similar to my recent (rejected) proposal for socket.sendall():
https://mail.python.org/pipermail/python-ideas/2014-April/027689.html
IMO the patch as it stands is fine as you can determine the number of bytes which were sent either by using the function return value or file.tell() (in case of error).
Also, updating the file offset on exit makes the sendfile() implementation behave exactly like send().
History
Date User Action Args
2014-04-22 02:13:21giampaolo.rodolasetrecipients: + giampaolo.rodola, pitrou, christian.heimes, asvetlov, neologix, akira, rosslagerwall, josh.r
2014-04-22 02:13:21giampaolo.rodolasetmessageid: <1398132801.2.0.998358929348.issue17552@psf.upfronthosting.co.za>
2014-04-22 02:13:21giampaolo.rodolalinkissue17552 messages
2014-04-22 02:13:20giampaolo.rodolacreate