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 santoso.wijaya
Recipients BreamoreBoy, alanjds, amaury.forgeotdarc, amiseler, mhammond, pysquared, santoso.wijaya, tim.peters, tim_evans
Date 2011-03-12.04:06:54
SpamBayes Score 2.222776e-05
Marked as misclassified No
Message-id <1299902815.77.0.0428437533401.issue706263@psf.upfronthosting.co.za>
In-reply-to
Content
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):
History
Date User Action Args
2011-03-12 04:06:55santoso.wijayasetrecipients: + santoso.wijaya, tim.peters, mhammond, pysquared, amaury.forgeotdarc, amiseler, tim_evans, alanjds, BreamoreBoy
2011-03-12 04:06:55santoso.wijayasetmessageid: <1299902815.77.0.0428437533401.issue706263@psf.upfronthosting.co.za>
2011-03-12 04:06:54santoso.wijayalinkissue706263 messages
2011-03-12 04:06:54santoso.wijayacreate