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 ncoghlan
Recipients ezio.melotti, flox, ncoghlan
Date 2013-04-25.07:47:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366876031.48.0.968397795128.issue17828@psf.upfronthosting.co.za>
In-reply-to
Content
Here's an example of the specific type errors raised by additional checks in the text-encoding specific methods. I believe the main improvement needed here is to mention the encoding name in the exception message:

"example".encode("rot_13")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: encoder did not return a bytes object (type=str)


b'BZh91AY&SY\xc1uvK\x00\x00\x01F\x80\x00\x10\x00"\x04\x00\x00\x10 \x000\xcd\x00\xc1\xa0P\xe2\xeeH\xa7\n\x12\x18.\xae\xc9`'.decode("bz2_codec")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: decoder did not return a str object (type=bytes)
History
Date User Action Args
2013-04-25 07:47:11ncoghlansetrecipients: + ncoghlan, ezio.melotti, flox
2013-04-25 07:47:11ncoghlansetmessageid: <1366876031.48.0.968397795128.issue17828@psf.upfronthosting.co.za>
2013-04-25 07:47:11ncoghlanlinkissue17828 messages
2013-04-25 07:47:11ncoghlancreate