Message216915
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). |
|
Date |
User |
Action |
Args |
2014-04-20 18:57:01 | giampaolo.rodola | set | recipients:
+ giampaolo.rodola, pitrou, christian.heimes, asvetlov, neologix, rosslagerwall |
2014-04-20 18:57:00 | giampaolo.rodola | set | messageid: <1398020220.84.0.838037889682.issue17552@psf.upfronthosting.co.za> |
2014-04-20 18:57:00 | giampaolo.rodola | link | issue17552 messages |
2014-04-20 18:57:00 | giampaolo.rodola | create | |
|