Antoine Pitrou <pit...@free.fr> added the comment: > > 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?
It uses fprintf(stderr, ...). That's the only thing it can do (there's no way sys.stderr is guaranteed to be usable at that point). If C stderr is invalid, then too bad. > Also, can we be sure that Python does not call C > library functions that write to stderr behind the scenes? I think you can guess the answer :) > What is the use case for "python >&-"? Is > it important enough to justify the risk of accidental data loss? I don't think so. One more important use case is when running a Unix daemon, which has (AFAIK) to close all std handles. I don't know how that interacts with using C stderr, especially if the handle closing is done in Python (and therefore only calls C close() and not fclose()!). Perhaps we should provide a sys function to fclose() C std{in,out,err}. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7111> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com