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 pitrou
Recipients eric.araujo, giampaolo.rodola, pitrou, rosslagerwall
Date 2011-12-11.18:52:44
SpamBayes Score 1.2667207e-09
Marked as misclassified No
Message-id <1323629565.31.0.145887845871.issue13564@psf.upfronthosting.co.za>
In-reply-to
Content
os.fstat wouldn't work since it succeeds with non-"regular" files, e.g. standard I/O:

>>> os.fstat(0)
posix.stat_result(st_mode=8592, st_ino=5, st_dev=11, st_nlink=1, st_uid=500, st_gid=5, st_size=0, st_atime=1323629303, st_mtime=1323629303, st_ctime=1323628616)

I think the best solution is to call sendfile() and catch OSError, then fallback on the generic loop. However, you must also guard against fileno() failing:

>>> io.BytesIO().fileno()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: fileno
History
Date User Action Args
2011-12-11 18:52:45pitrousetrecipients: + pitrou, giampaolo.rodola, eric.araujo, rosslagerwall
2011-12-11 18:52:45pitrousetmessageid: <1323629565.31.0.145887845871.issue13564@psf.upfronthosting.co.za>
2011-12-11 18:52:44pitroulinkissue13564 messages
2011-12-11 18:52:44pitroucreate