Message203956
The examples from the 3.4 What's New may make it clearer why the exception wrapping in the codec machinery is much broader in scope that just detecting output type errors (even though handling that case was the original motivation for the idea):
>>> import codecs
>>> codecs.decode(b"abcdefgh", "hex")
binascii.Error: Non-hexadecimal digit found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
binascii.Error: decoding with 'hex' codec failed (Error: Non-hexadecimal digit found)
>>> codecs.encode("hello", "bz2")
TypeError: 'str' does not support the buffer interface
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not support the buffer interface) |
|
Date |
User |
Action |
Args |
2013-11-23 02:20:14 | ncoghlan | set | recipients:
+ ncoghlan, lemburg, doerwalter, vstinner, ezio.melotti, python-dev, serhiy.storchaka |
2013-11-23 02:20:14 | ncoghlan | set | messageid: <1385173214.47.0.135960158308.issue19619@psf.upfronthosting.co.za> |
2013-11-23 02:20:14 | ncoghlan | link | issue19619 messages |
2013-11-23 02:20:14 | ncoghlan | create | |
|