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.

作者 ezio.melotti
收信人 barry, ezio.melotti, flox, ncoghlan
日期 2013-05-10.04:36:13
SpamBayes Score -1.0
Marked as misclassified
Message-id <1368160573.65.0.704549183111.issue17828@psf.upfronthosting.co.za>
In-reply-to
内容
The attached proof of concept catches Type/ValueError in str.encode and raises another exception with a better message:
>>> 'example'.encode('hex_codec')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: invalid input type for hex_codec codec ('str' does not support the buffer interface)

(note: the patch doesn't handle the exception chaining yet and probably leaks.)

If Nick proposal in msg187704 is accepted, this should become a codecs.EncodeTypeError.  The same should then be done for bytes.decode and for codecs.encode/decode.
历史
日期 用户 动作 参数
2013-05-10 04:36:13ezio.melotti修改recipients: + ezio.melotti, barry, ncoghlan, flox
2013-05-10 04:36:13ezio.melotti修改messageid: <1368160573.65.0.704549183111.issue17828@psf.upfronthosting.co.za>
2013-05-10 04:36:13ezio.melotti链接issue17828 messages
2013-05-10 04:36:13ezio.melotti创建