Eric Smith wrote: > Is this deliberate? I can file a bug report if need be, just let me know.
I'm sure it is a bug. The site.installnewio() function doesn't set the names. The attached patch fixes the issue and adds an unit test, too. Christian
Index: Lib/site.py =================================================================== --- Lib/site.py (revision 57077) +++ Lib/site.py (working copy) @@ -415,8 +415,11 @@ return io.open(*args, **kwds) __builtin__.open = open sys.__stdin__ = sys.stdin = io.open(0, "r") + sys.__stdin__.name = '<stdin>' sys.__stdout__ = sys.stdout = io.open(1, "w") + sys.__stdout__.name = '<stdout>' sys.__stderr__ = sys.stderr = io.open(2, "w") + sys.__stderr__.name = '<stderr>' def main(): Index: Lib/test/test_sys.py =================================================================== --- Lib/test/test_sys.py (revision 57077) +++ Lib/test/test_sys.py (working copy) @@ -338,6 +338,10 @@ setattr(s, s, s) self.assertEqual(getattr(s, s), s) + def test_std_names(self): + self.assertEqual(sys.stdin.name, '<stdin>') + self.assertEqual(sys.stdout.name, '<stdout>') + self.assertEqual(sys.stderr.name, '<stderr>') def test_main(): test.test_support.run_unittest(SysModuleTest)
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com