Message188808
To summarize:
* str.encode does only str->bytes;
* bytes.decode does only bytes-> str;
* codecs.encode/decode do obj->obj;
The things that could go wrong are:
1) the input type is wrong (i.e. the codec doesn't accept the type of the input);
2) the input value is invalid;
3) for str.encode/bytes.decode only, the output type is wrong (i.e. the codec returned a non-bytes/non-str object);
My patch only covers 3. The four new exceptions suggested by Nick in msg187704 would cover the first 2 cases.
For str.encode/bytes.decode, if we knew the input type accepted by the codec we could also provide a better error message (e.g. "codecs accepts '...', not '...'; use ... instead"), but we don't. |
|
Date |
User |
Action |
Args |
2013-05-10 03:52:40 | ezio.melotti | set | recipients:
+ ezio.melotti, barry, ncoghlan, flox |
2013-05-10 03:52:40 | ezio.melotti | set | messageid: <1368157960.54.0.28244812057.issue17828@psf.upfronthosting.co.za> |
2013-05-10 03:52:40 | ezio.melotti | link | issue17828 messages |
2013-05-10 03:52:40 | ezio.melotti | create | |
|