New submission from STINNER Victor: 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 <solip...@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". ---------- messages: 195836 nosy: haypo, pitrou priority: normal severity: normal status: open title: pythorun.c: is_valid_fd() should not duplicate the file descriptor versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18804> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com