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 desbma
Recipients desbma, martin.panter, python-dev, r.david.murray
Date 2015-09-13.17:18:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If I understand you correctly, a naive implementation like this:

use_chunk_copy = False
  fdsrc = fsrc.fileno()
  fddst = fdst.fileno()
except OSError:
  # fallback on current chunk based Python copy
  use_chunk_copy = True
  # we have 2 fd, try sendfile
    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:00desbmasetrecipients: + desbma, r.david.murray, python-dev, martin.panter
2015-09-13 17:18:00desbmasetmessageid: <>
2015-09-13 17:18:00desbmalinkissue25063 messages
2015-09-13 17:18:00desbmacreate