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 amcnabb
Recipients amcnabb
Date 2010-02-18.06:41:13
SpamBayes Score 8.715134e-08
Marked as misclassified No
Message-id <1266475277.48.0.657351294204.issue7955@psf.upfronthosting.co.za>
In-reply-to
Content
The following snippet behaves differently in the C IO implementation than in the Python IO implementation:

  import sys
  sys.stdout.write('unicode ')
  sys.stdout.buffer.write(b'bytes ')

To test this, I have created two scripts, testpyio.py (using _pyio) and testio.py (using _io).  The output is as follows:

% python3 testpyio.py
unicode bytes
% python3 testio.py
bytes unicode
%

In my opinion, the behavior exhibited by _pyio is more correct.  It appears that to get the C implementation to print the lines in the correct order, there must be a flush in between the statements.  This extra flush would create a lot of overhead.

I am attaching the two test scripts.

The C implementation prints the output in the correct order if each write ends with a newline.
History
Date User Action Args
2010-02-18 06:41:17amcnabbsetrecipients: + amcnabb
2010-02-18 06:41:17amcnabbsetmessageid: <1266475277.48.0.657351294204.issue7955@psf.upfronthosting.co.za>
2010-02-18 06:41:15amcnabblinkissue7955 messages
2010-02-18 06:41:14amcnabbcreate