[issue2768] os.fstat and other os.f* methods should use PyObject_AsFileDescriptor

Antoine Pitrou report at bugs.python.org
Thu Mar 25 17:00:30 CET 2010

Antoine Pitrou <pitrou at free.fr> added the comment:

Actually, I'm not sure it's a good idea. For example, calling os.ftruncate(fobj) on a py3k file object will bypass the object's internal buffering, ignoring any pending buffered data; the right thing to do is to call fobj.truncate() instead.

It may be better to simply mention in the docs that fileno() can be used on file-like objects to get a file descriptor, if needed.

nosy: +loewis

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list