deb-python-traceback2/README.rst
Robert Collins 652c95d267 Handle objects with broken __unicode__
Because Python 2 objects may have __unicode__ broken, and we need
unicode output to avoid implicit decodes, explicitly handle
__unicode__.
2015-03-09 13:31:29 +13:00

550 B

A backport of traceback to older supported Pythons.

>>> import traceback2 as traceback

Profit.

Things to be aware of!

In Python 2.x, unlike traceback, traceback2 creates unicode output (because it depends on the linecache2 module).

Exception frame clearing silently does nothing if the interpreter in use does not support it.

traceback2._some_str, which while not an official API is so old its likely in use behaves similarly to the Python3 version - objects where unicode(obj) fails but str(object) works will be shown as b'thestrvaluerepr'.