Eryk Sun <eryk...@gmail.com> added the comment:

> make it returning False without invoking a system call if the file
> size is non-zero it will eliminate the need to expose _size.

I suggest using the file type instead of the size. There's no reason to call 
isatty() if it's not an S_IFCHR file. This will avoid calling isatty() on 
regular files that happen to be empty.

In Windows, isatty(fd) is based solely on the file type, which is flagged in 
the fd record when a file descriptor is opened for a native file handle. It's 
not a system call, but it's also nearly worthless for how isatty() is typically 
used, since it's true for any S_IFCHR file (e.g. con, nul, com1).

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45944>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to