Author ezio.melotti
Recipients barry, ezio.melotti, flox, ncoghlan
Date 2013-05-10.04:36:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368160573.65.0.704549183111.issue17828@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-05-10 04:36:13ezio.melottisetrecipients: + ezio.melotti, barry, ncoghlan, flox
2013-05-10 04:36:13ezio.melottisetmessageid: <1368160573.65.0.704549183111.issue17828@psf.upfronthosting.co.za>
2013-05-10 04:36:13ezio.melottilinkissue17828 messages
2013-05-10 04:36:13ezio.melotticreate