Issue 13321: fstat doesn't accept an object with "fileno" method (original) (raw)
This is a request for new functionality, so marking as a feature request for 3.3. If implemented, the change should be applied to many other functions, in the os module at least.
I'm not sure whether this is very useful, though. The fstat(f.fileno()) idiom doesn't require that much writing and makes it explicit that we're operating on an underlying file descriptor. Furthermore, funtions in the os module are low-level and map very closely to the underlying C API.
If I understand it correctly, this change request is to change os.fstat(obj) (and probably other functions) to call obj.fileno(), instead of the caller doing that?
If so, -1. Keep os.fstat() as a thin wrapper around fstat.