This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients pitrou, vstinner
Date 2013-08-21.23:07:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377126467.82.0.012503473328.issue18804@psf.upfronthosting.co.za>
In-reply-to
Content
is_valid_fd() of Python/pythorun.c should use fstat() to check if a file descriptor is valid, instead of duplicating it using dup() (and then closing it).

If Windows needs a special check, it would be better to run checks on the handle of the file descriptor.

The function was added by the following changeset:

----------------------------
branch:      3.2
parent:      73773:661fb211f220
user:        Antoine Pitrou <solipsis@pitrou.net>
date:        Mon Nov 28 19:08:36 2011 +0100
files:       Lib/test/test_cmd_line.py Misc/NEWS Python/pythonrun.c
description:
Issue #7111: Python can now be run without a stdin, stdout or stderr stream.

It was already the case with Python 2.  However, the corresponding
sys module entries are now set to None (instead of an unusable file object).
----------------------------


See also issue #17797 "Visual C++ 11.0 reports fileno(stdin) == 0 for non-console program".
History
Date User Action Args
2013-08-21 23:07:47vstinnersetrecipients: + vstinner, pitrou
2013-08-21 23:07:47vstinnersetmessageid: <1377126467.82.0.012503473328.issue18804@psf.upfronthosting.co.za>
2013-08-21 23:07:47vstinnerlinkissue18804 messages
2013-08-21 23:07:47vstinnercreate