On Fri, 04 Mar 2011 13:40:16 +0100 Victor Stinner <victor.stin...@haypocalc.com> wrote: > > I am still bothered by the fact that, > > > > >>> import faulthandler > > >>> faulthandler.enable() > > >>> import sys > > >>> sys.stderr.close() > > >>> sys.stderr = open('logs/error.log', 'wb') > > >>> faulthandler.sigsegv() > > > > , does the wrong thing. > > faulthandler.enable() uses sys.stderr by default: it keeps a reference > on this object and stores its descriptor (should be 2). If you close the > file descriptor (eg. sys.stderr.close())
sys.stderr.close() doesn't close the file descriptor under Python 3: >>> import sys, os >>> sys.stderr.close() >>> os.write(2, b"foo\n") foo 4 Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com