[issue1488934] file.write + closed pipe = no error
report at bugs.python.org
Wed Jan 12 14:16:27 CET 2011
Charles-Francois Natali <neologix at free.fr> added the comment:
This is normal behaviour: stdout is normally line buffered (_IOLBF) only if connected to a tty.
When it's not connected to a tty, it's full buffered (_IOFBF). This is done on purpose for performance reason. To convince yourself, run
$ cat test.py
for i in range(1, 1000000):
$ time python test.py > /tmp/foo
With buffering off (-u option), the same commande takes almost 10 times longer.
If the application wants to be sure to receive a SIGPIPE when the pipe's end is closed, it should just flush stdout explicitely (sys.stdout.flush()).
Suggesting to close.
nosy: +neologix, pitrou
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list