[issue7111] abort when stderr is closed

Alexander Belopolsky report at bugs.python.org
Thu Feb 3 20:56:37 CET 2011


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou <report at bugs.python.org> wrote:
..
>> Do you know of places where we use fd 2 instead of sys.stderr?
>
> We normally don't. One reason is that buffering inside sys.stderr can
> make ordering of output incorrect. There are some places in C code where
> we do "fprintf(stderr, ...)" but that's for specialized debugging
> (disabled in normal builds) or fatal error messages.

This is the case that I had in mind.  What does non-debug build do on
a fatal error?  Also, can we be sure that Python does not call C
library functions that write to stderr behind the scenes?  If vanilla
Python is safe to run with closed fd 2, that may not be the case for
3rd party extensions.    What is the use case for "python >&-"?    Is
it important enough to justify the risk of accidental data loss?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7111>
_______________________________________


More information about the Python-bugs-list mailing list