[issue28603] traceback module can't format/print unhashable exceptions

Jelle Zijlstra report at bugs.python.org
Tue Dec 13 03:01:16 EST 2016


Jelle Zijlstra added the comment:

I ran into this bug through Thrift-generated exception classes (also reported there as https://issues.apache.org/jira/browse/THRIFT-4002).

I've added a few potential solutions:
- issue28603-listset.patch turns the seen set into a list if hashing fails. However, this adds a lot of complexity, especially in C, and because seen is changed halfway through the recursion, we may end up showing an exception twice.
- issue28603-list.patch uses a list instead of a set for seen. This is theoretically slower, but in practice it seems unlikely that exception __cause__ and __context__ would nest deep enough for this to be an issue.
- issue28603-ignore.patch takes a similar approach to Trundle's patch and just gives up when the value is not hashable. This means we lose cause/context information for these exceptions.

I prefer issue28603-list.patch.

----------
nosy: +Jelle Zijlstra
Added file: http://bugs.python.org/file45870/issue28603-list.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28603>
_______________________________________


More information about the Python-bugs-list mailing list