[issue7111] abort when stderr is closed

2011-11-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks, committed. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue7111] abort when stderr is closed

2011-11-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset f15943505db0 by Antoine Pitrou in branch '3.2': Issue #7111: Python can now be run without a stdin, stdout or stderr stream. http://hg.python.org/cpython/rev/f15943505db0 New changeset c86fb10eaf68 by Antoine Pitrou in branch 'default': Issue #7111

[issue7111] abort when stderr is closed

2011-11-28 Thread Charles-François Natali
Charles-François Natali added the comment: > Updated patch. > LGTM. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue7111] abort when stderr is closed

2011-11-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Updated patch. -- Added file: http://bugs.python.org/file23794/nostdio2.patch ___ Python tracker ___ ___

[issue7111] abort when stderr is closed

2011-11-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: > +is_valid_fd(int fd) > [...] > +dummy_fd = dup(fd); > +if (dummy_fd < 0) > +return 0; > +close(dummy_fd); > > Why not use fstat() instead (does Windows have fstat()? And dup()?). Windows has dup(), but no fstat(). > +@unittest.skipIf

[issue7111] abort when stderr is closed

2011-11-27 Thread Charles-François Natali
Charles-François Natali added the comment: (No Rietveld link): +is_valid_fd(int fd) [...] +dummy_fd = dup(fd); +if (dummy_fd < 0) +return 0; +close(dummy_fd); Why not use fstat() instead (does Windows have fstat()? And dup()?). +@unittest.skipIf(os.name == 'nt', "test

[issue7111] abort when stderr is closed

2011-11-26 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue7111] abort when stderr is closed

2011-11-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Attached patch allows Python to run even if no standard stream is available. I use dup() to detect whether a fd is valid. -- keywords: +patch nosy: +neologix stage: -> patch review versions: +Python 3.3 -Python 3.1 Added file: http://bugs.python.org/f

[issue7111] abort when stderr is closed

2011-02-03 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Thu, Feb 3, 2011 at 12:18 PM, Antoine Pitrou wrote: > I just took a look at http://pypi.python.org/pypi/python-daemon/, and it > uses dup2() to redirect standard streams, which is far nicer. I'm more worried about the case where a daemon launches python.

[issue7111] abort when stderr is closed

2011-02-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > 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 just took a look at http://pypi.python.org/pypi/python-daemon/, and it uses dup2() to redirect standard streams, which is far nicer.

[issue7111] abort when stderr is closed

2011-02-03 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Thu, Feb 3, 2011 at 11:56 AM, Alexander Belopolsky wrote: > 3rd party extensions.    What is the use case for "python >&-"?    Is > it important enough to justify the risk of accidental data loss? I don't think closing stderr via the command line is an im

[issue7111] abort when stderr is closed

2011-02-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le jeudi 03 février 2011 à 19:59 +, Alexander Belopolsky a écrit : > Alexander Belopolsky added the comment: > > > On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou > > wrote: > > .. > >> Do you know of places where we use fd 2 instead of sys.stderr? > > >

[issue7111] abort when stderr is closed

2011-02-03 Thread Antoine Pitrou
Antoine Pitrou 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

[issue7111] abort when stderr is closed

2011-02-03 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +exarkun, loewis ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue7111] abort when stderr is closed

2011-02-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou wrote: > .. >> Do you know of places where we use fd 2 instead of sys.stderr? > > We normally don't. Hmm, grep "fprintf(stderr," returned 122 hits in the py3k branch. Are you sure these are all debug-build

[issue7111] abort when stderr is closed

2011-02-03 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou 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

[issue7111] abort when stderr is closed

2011-02-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > That's an interesting point. > > 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(stde

[issue7111] abort when stderr is closed

2011-02-03 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: That's an interesting point. Do you know of places where we use fd 2 instead of sys.stderr? -- ___ Python tracker ___ ___

[issue7111] abort when stderr is closed

2011-02-02 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On the second thought, as long as python used fd 2 as the "message stream of last resort", we should probably not allow it to run with fd 2 closed. The problem is that in this case fd 2 may become associated with a very important file contents of which