Message250578
If I understand you correctly, a naive implementation like this:
use_chunk_copy = False
try:
fdsrc = fsrc.fileno()
fddst = fdst.fileno()
except OSError:
# fallback on current chunk based Python copy
use_chunk_copy = True
else:
# we have 2 fd, try sendfile
try:
os.sendfile(fdsrc, fddst)
except AttributeError:
# sendfile not available
use_chunk_copy = True
if use_chunk_copy:
# use current Python based chunk copy
...would not work because some file like objects expose fileno(), even though it does not accurately represent the file because they wrap it to add special behavior (like GzipFile).
I don't understand, if they alter the file behavior, why do they expose fileno()? |
|
Date |
User |
Action |
Args |
2015-09-13 17:18:00 | desbma | set | recipients:
+ desbma, r.david.murray, python-dev, martin.panter |
2015-09-13 17:18:00 | desbma | set | messageid: <1442164680.41.0.014274463486.issue25063@psf.upfronthosting.co.za> |
2015-09-13 17:18:00 | desbma | link | issue25063 messages |
2015-09-13 17:18:00 | desbma | create | |
|