Message216979
> 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(). |
|
Date |
User |
Action |
Args |
2014-04-22 02:13:21 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola, pitrou, christian.heimes, asvetlov, neologix, akira, rosslagerwall, josh.r |
2014-04-22 02:13:21 | giampaolo.rodola | set | messageid: <1398132801.2.0.998358929348.issue17552@psf.upfronthosting.co.za> |
2014-04-22 02:13:21 | giampaolo.rodola | link | issue17552 messages |
2014-04-22 02:13:20 | giampaolo.rodola | create | |
|