[issue13609] Add "os.get_terminal_size()" function
Amaury Forgeot d'Arc
report at bugs.python.org
Fri Jan 6 14:44:57 CET 2012
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
Some remarks on the Windows implementation in termsize.diff.4:
- On Windows, the C runtime always sets fileno(stdout) to 1, so hardcoded values are OK.
But on Unix, I'm quite sure that embedded interpreters (mod_python?) sometimes close the standard descriptor, so fd=1 can refer to something entirely different.
Does it makes sense to initialize fd=fileno(stdout) (this is C code) instead?
- When GetStdHandle() returns INVALID_HANDLE_VALUE, PyErr_SetFromWindowsErr(0) should be used.
And it's not necessary to use GetLastError(), 0 is enough.
- GetStdHandle will return NULL in a non-console application (try with pythonw.exe or IDLE), I think a specific error message should be raised in this case.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13609>
_______________________________________
More information about the Python-bugs-list
mailing list