Santoso Wijaya <[email protected]> added the comment:
This is indeed reproducible in Python 2.7. The following unittest will expose
it. However, patching sys.std* to None will break `print` statements to raise
AttributeError in pythonw.exe programs, though it won't mysteriously break only
after printing 4 kbytes...
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
old mode 100644
new mode 100755
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -58,6 +58,19 @@
new = sys.getrefcount(path)
self.assertEqual(old, new)
+ @unittest.skipUnless(sys.platform == 'win32',
+ 'test specific to Windows console')
+ def test_print_no_stdout(self):
+ # Issue #706263: pythonw.exe will raise an IOError after
+ # attempting to print more than 4096 bytes (it silently
+ # succeeds for the first 4096 bytes and fails with an
+ # IOError: "[Errno 9] Bad file descriptor" on the 4097th byte.
+ DETACHED_PROCESS = 0x00000008
+ command = [sys.executable, '-c',
+ 'for _ in xrange(100000): print "a", ']
+ retcode = subprocess.call(command, creationflags=DETACHED_PROCESS)
+ self.assertEqual(retcode, 0)
+
class TemporaryFileTests(unittest.TestCase):
def setUp(self):
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue706263>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com