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 serhiy.storchaka
Recipients alexandre.vassalotti, jaraco, joncle, pitrou, serhiy.storchaka
Date 2017-02-19.19:24:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487532275.94.0.627516959072.issue24159@psf.upfronthosting.co.za>
In-reply-to
Content
I think it is worth to improve the error message in the write() method of binary files.

>>> sys.stdout.write(b'')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: write() argument must be str, not bytes
>>> sys.stdout.buffer.write('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'str'
>>> sys.stdout.buffer.raw.write('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'str'

But this is large issue. Other file-like objects (GzipFile, ZipExtFile etc) should be updated too.
History
Date User Action Args
2017-02-19 19:24:36serhiy.storchakasetrecipients: + serhiy.storchaka, jaraco, pitrou, alexandre.vassalotti, joncle
2017-02-19 19:24:35serhiy.storchakasetmessageid: <1487532275.94.0.627516959072.issue24159@psf.upfronthosting.co.za>
2017-02-19 19:24:35serhiy.storchakalinkissue24159 messages
2017-02-19 19:24:35serhiy.storchakacreate