Message188809
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. |
|
Date |
User |
Action |
Args |
2013-05-10 04:36:13 | ezio.melotti | set | recipients:
+ ezio.melotti, barry, ncoghlan, flox |
2013-05-10 04:36:13 | ezio.melotti | set | messageid: <1368160573.65.0.704549183111.issue17828@psf.upfronthosting.co.za> |
2013-05-10 04:36:13 | ezio.melotti | link | issue17828 messages |
2013-05-10 04:36:13 | ezio.melotti | create | |
|