Charles-François Natali neolo...@free.fr added the comment:
Updated patch.
LGTM.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
___
Roundup Robot devn...@psf.upfronthosting.co.za 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
Antoine Pitrou pit...@free.fr added the comment:
Thanks, committed.
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
Charles-François Natali neolo...@free.fr 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
Antoine Pitrou pit...@free.fr 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().
+
Antoine Pitrou pit...@free.fr added the comment:
Updated patch.
--
Added file: http://bugs.python.org/file23794/nostdio2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
Antoine Pitrou pit...@free.fr 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:
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
Daniel Stutzbach stutzb...@google.com added the comment:
That's an interesting point.
Do you know of places where we use fd 2 instead of sys.stderr?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
Antoine Pitrou pit...@free.fr 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
Alexander Belopolsky belopol...@users.sourceforge.net added the comment:
On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou rep...@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
Alexander Belopolsky belopol...@users.sourceforge.net added the comment:
On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou rep...@bugs.python.org 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
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +exarkun, loewis
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7111
___
___
Python-bugs-list
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
Antoine Pitrou pit...@free.fr added the comment:
Le jeudi 03 février 2011 à 19:59 +, Alexander Belopolsky a écrit :
Alexander Belopolsky belopol...@users.sourceforge.net added the comment:
On Thu, Feb 3, 2011 at 2:44 PM, Antoine Pitrou rep...@bugs.python.org
wrote:
..
Do you know
Daniel Stutzbach stutzb...@google.com added the comment:
On Thu, Feb 3, 2011 at 11:56 AM, Alexander Belopolsky
rep...@bugs.python.org 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
Antoine Pitrou pit...@free.fr 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
Daniel Stutzbach stutzb...@google.com added the comment:
On Thu, Feb 3, 2011 at 12:18 PM, Antoine Pitrou rep...@bugs.python.org 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
Alexander Belopolsky belopol...@users.sourceforge.net 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
19 matches
Mail list logo