It's surprising and broken that stderr should be buffered in python3. python3
calls setvbuf(3) on stderr at startup to achieve this chuckle-headed behavior.
It makes stderr line buffered if on a terminal, and fully buffered if
redirected to a log file. A fully buffered stderr is a very bad idea.
This change goes against the C89 and C99 standards, 40+ years of precedent, and
the behavior of nearly every other current programming language.
Error messages will not show up in logs on time, and may be completely lost if
the process is terminated before the buffer is flushed, e.g. with SIGTERM
How about fixing this?
Until then, we should write this in every script:
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
--
https://mail.python.org/mailman/listinfo/python-list