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 ned.deily
Recipients Wes.McKinney, akuchling, ned.deily, pitrou
Date 2010-10-19.20:07:50
SpamBayes Score 3.4416914e-13
Marked as misclassified No
Message-id <1287518872.78.0.450527447458.issue10144@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is reproducible with the python2 versions I have access to, that is, on Mac OS X and Debian Linux, and likewise not with any of the python3 3.1 and 3.2 versions.  It is most likely due to the underlying ncurses library interacting with the libc stdio, maybe changing the buffer size of the stdout file. The output is flushed as expected if the program is changed to use the python2.7 io module to write to stdout, like python3 does, rather than print which uses the 'file' object.  As a workaround on python2, it looks like the expected behavior can be restored by closing and reopening sys.stdout with something like this:

   f()
   stdout=sys.stdout
   print('Calling bug() now!')
   bug()
   fn = sys.stdout.fileno()
   sys.stdout.close()
   sys.stdout = os.fdopen(fn,'a')
   f()
History
Date User Action Args
2010-10-19 20:07:52ned.deilysetrecipients: + ned.deily, akuchling, pitrou, Wes.McKinney
2010-10-19 20:07:52ned.deilysetmessageid: <1287518872.78.0.450527447458.issue10144@psf.upfronthosting.co.za>
2010-10-19 20:07:50ned.deilylinkissue10144 messages
2010-10-19 20:07:50ned.deilycreate