[issue13601] sys.stderr should be unbuffered (or always line-buffered)
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: I'm hesitant to make it line-buffered by default when directed to a file, since this could significantly slow down a program that for some reason produces super-voluminous output (e.g. when running a program with heavy debug logging turned on). Is that really the purpose of standard error though? Heavy debug output, in my experience, is usually sent to standard output or to another file. Also, did anyone ever complain about this as a problem, given it is the default behaviour of Python 2? In my view the requirements of seeing errors when they happen, and guaranteeing that they will always be seen no matter what happens afterwards, should weigh more heavily than this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13601 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13601] sys.stderr should be unbuffered (or always line-buffered)
Changes by Geoffrey Bache gjb1...@users.sourceforge.net: -- nosy: +gjb1002 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13601 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13601] sys.stderr should be unbuffered (or always line-buffered)
Antoine Pitrou pit...@free.fr added the comment: Line-buffering should be good enough since in practice errors messages are always terminated by a newline. What I think too. I'm hesitant to make it line-buffered by default when directed to a file, since this could significantly slow down a program that for some reason produces super-voluminous output (e.g. when running a program with heavy debug logging turned on). The slow-down is impressive in relative terms (6x) but the timings are still small in absolute value: $ ./python -m timeit -s f=open('/dev/null', 'a', buffering=4096) f.write('log message\n') 1000 loops, best of 3: 0.156 usec per loop $ ./python -m timeit -s f=open('/dev/null', 'a', buffering=1) f.write('log message\n') 100 loops, best of 3: 0.961 usec per loop -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13601 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13601] sys.stderr should be unbuffered (or always line-buffered)
Antoine Pitrou pit...@free.fr added the comment: Oops, I forgot the last two questions: Maybe we need better command-line control to override the defaults? We already have -u to switch all stdio to unbuffered. This issue proposes to make stderr line-buffered/unbuffered by default, since it's less surprising than fully buffered. Are there precedents e.g. in Bash flags? Well, `man bash` doesn't appear to say anything about stdio buffering. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13601 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13601] sys.stderr should be unbuffered (or always line-buffered)
New submission from Antoine Pitrou pit...@free.fr: In issue13597, Philip Jenvey points out: “I'm surprised to hear that stderr is line buffered by default. Historically stderr is never buffered (at least on POSIX) and for good reason: errors should be seen immediately” Recent changes to the IO stack should allow stderr to be opened in fully unbuffered mode (and open(..., 'w', buffering=0) can be allowed too). Or at least it could be always line-buffered, even when redirected to a file. -- components: IO, Interpreter Core, Library (Lib) messages: 149447 nosy: benjamin.peterson, gvanrossum, pitrou, pjenvey, stutzbach priority: normal severity: normal stage: needs patch status: open title: sys.stderr should be unbuffered (or always line-buffered) type: behavior versions: Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13601 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13601] sys.stderr should be unbuffered (or always line-buffered)
Guido van Rossum gu...@python.org added the comment: I *thought* I mimicked what C stdio did ~20 years ago... I'd be happy to follow what it does today if it changed or if I made a mistake. That said, IMO: Line-buffering should be good enough since in practice errors messages are always terminated by a newline. I'm hesitant to make it line-buffered by default when directed to a file, since this could significantly slow down a program that for some reason produces super-voluminous output (e.g. when running a program with heavy debug logging turned on). Maybe we need better command-line control to override the defaults? Are there precedents e.g. in Bash flags? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13601 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com