[issue29996] Use terminal width by default in pprint
Eryk Sun
report at bugs.python.org
Wed Apr 5 18:07:04 EDT 2017
Eryk Sun added the comment:
> Though I don't have any idea if it works on Windows, but it seems
> properly factored.
Generally it should. However, os.get_terminal_size is unnecessarily limited to the standard handles with a hard-coded mapping 0 => StandardInput, 1 => StandardOutput, and 2 => StandardError, and otherwise raises ValueError. Example failure:
>>> fd = os.open('conout$', os.O_RDWR)
>>> os.isatty(fd)
True
>>> os.get_terminal_size(fd)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: bad file descriptor
There is no need to involve the standard handles. It should call _get_osfhandle(fd).
----------
nosy: +eryksun
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29996>
_______________________________________
More information about the Python-bugs-list
mailing list