homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zbysz
Recipients Arfrever, amaury.forgeotdarc, denilsonsa, giampaolo.rodola, loewis, neologix, pitrou, rosslagerwall, vstinner, zbysz
Date 2012年01月06日.12:30:14
SpamBayes Score 6.9968475e-12
Marked as misclassified No
Message-id <1325853017.71.0.936491533882.issue13609@psf.upfronthosting.co.za>
In-reply-to
Content
Following comments by Martin and Victor, here is next version: termsize.diff.4
Changes:
- just check for defined(MS_WINDOWS) and rely on <windows.h>.
- rename query_terminal_size to get_terminal_size_raw
 This way it should be clearer that the second one is low-level,
 and should be less exposed. I don't want to call it
 _get_terminal_size() because it is not just an implementation
 detail and would sometimes be called directly.
- NotImplementedError is gone. get_terminal_size_raw() is not
 defined if not possible.
Non-changes:
- sys.__stdout__.fileno() is not changed to 1, because as Antoine
 pointed out, it is set at runtime.
- STDOUT_FILENO: not defined on windows, so just use 1 and add a comment
- fd argument is retained, because we might want to test terminals
 opened with openpty.
- two functions: still there. I think that get_terminal_size() should
 provide an easy-to-use, even trivial-to-use, way to get a sensible
 value without writing a wrapper. In the _majority_ of cases the
 wrapper would be something like get_terminal_size() currently.
- named tuple: like Antoine said, it gives nice syntax.
- testing for <sys/ioctl.h>: in termios and other modules, setup.py
 first tests if we are on unix. But there might be unices without
 TIOCGWINSZ, and non-unix systems where TIOCGWINSZ _is_ defined,
 so it seems a functional test is simpler and more robust.
Tested on linux and windows XP.
History
Date User Action Args
2012年01月06日 12:30:18zbyszsetrecipients: + zbysz, loewis, amaury.forgeotdarc, pitrou, vstinner, giampaolo.rodola, Arfrever, denilsonsa, neologix, rosslagerwall
2012年01月06日 12:30:17zbyszsetmessageid: <1325853017.71.0.936491533882.issue13609@psf.upfronthosting.co.za>
2012年01月06日 12:30:17zbyszlinkissue13609 messages
2012年01月06日 12:30:16zbyszcreate

AltStyle によって変換されたページ (->オリジナル) /