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.

Author ncoghlan
Recipients ncoghlan
Date 2014-01-02.02:23:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1388629413.58.0.988087871801.issue20105@psf.upfronthosting.co.za>
In-reply-to
Content
The exception chaining in the codecs subsystem is currently losing the details of the original traceback.

Compare this traceback from Python 3.3:

>>> codecs.decode(b"abcdefgh", "hex_codec")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.3/encodings/hex_codec.py", line 20, in hex_decode
    return (binascii.a2b_hex(input), len(input))
binascii.Error: Non-hexadecimal digit found

With the current behaviour of Python 3.4:

>>> 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)

The original traceback header and details are missing in the latter. It should look more like the following:

>>> try:
...     1/0
... except Exception as e:
...     raise Exception("Explicit chaining") from e
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
Exception: Explicit chaining
History
Date User Action Args
2014-01-02 02:23:33ncoghlansetrecipients: + ncoghlan
2014-01-02 02:23:33ncoghlansetmessageid: <1388629413.58.0.988087871801.issue20105@psf.upfronthosting.co.za>
2014-01-02 02:23:33ncoghlanlinkissue20105 messages
2014-01-02 02:23:31ncoghlancreate