Message216915
| Author |
giampaolo.rodola |
| Recipients |
asvetlov, christian.heimes, giampaolo.rodola, neologix, pitrou, rosslagerwall |
| Date |
2014年04月20日.18:56:56 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1398020220.84.0.838037889682.issue17552@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
New patch in attachment. Changes:
- docs
- replaced select() / poll() with the new selectors module
- file position is always updated both on return and on error; this means file.tell() is the designated way to know how many bytes were sent
- replaced sendall() with send() so that we can count the number of bytes transmitted (related and rejected proposal: https://mail.python.org/pipermail/python-ideas/2014-April/027689.html)
- send() now uses memoryview() for better performances to re-transmit data which was not sent by the first send() call
- pre-emptively raise exception if file is not opened in binary mode
- tests for ssl module
I've tried to work on Windows TransmitFile support but I got stuck as I'm not sure how to convert a file object into a HANDLE in C. I suppose Windows support can also be added later as a separate ticket and in the meantime I'd like to push this forward.
Open questions:
- Is the current return value desirable (do we really care if os.sendfile() was used internally?)? Should the returned tuple also include the number transmitted bytes?
- default blocksize: Charles-François was suggesting to remove the blocksize argument; FWIW I've made some quick benchmarks by using "time" cmdline utility with different blocksizes and I didn't notice substantial difference. I still think a blocksize parameter is necessary in case we fallback on using send() and also for consistency with ftplib's storbinary() method which will be involved later (issue 13564). |
|