Zbyszek Szmek <zbys...@in.waw.pl> added the comment: > New try (I fixed my email address and the patch). > > The purpose of os.get_terminal_size() is the same as `stty size`, so > `stty size` could be a model for behavior of os.get_terminal_size(). I guess that this fallback will make some things easier. As long it is documented, the user should be able to get whatever behaviour they want.
I have four small questions: - -1 is used as the argument meaning "try stdout and stdin". But -1 is also used the error return value for open(2) and other system functions. I know that Python checks the return value to throw an exception, and -1 shouldn't "leak" and be passed by mistake to os.get_terminal_size(). Can someone confirm that this is the case? - Why stderr is not checked too? It would make os.get_terminal_size() return the real terminal value in a the middle of a pipe: cat | python -c 'import os; os.get_terminal_size()' | cat. - some doc change is missing - in the new version the line with ioctl(fd, TIOCGWINSZ, &w) repeats three times. It think it could be reduced to two without loss of readability. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13609> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com