Allow logging of unhashable exceptions in Python 3
A bug in the Python 3 standard library, https://bugs.python.org/issue28603 means that calling the traceback
module with an exception chain that includes an unhashable exception
results in a TypeError being raised. (In Python 3, any classes that
define __eq__() without also explicitly defining - not inheriting -
__hash__() will be unhashable.) The TypeError itself is also part of
such a chain, since its __context__ will be the unhashable exception. If
we don't catch it then the thread will simply exit mysteriously, and no
amount of logging will be able to reveal to the user what happened.
Reviewed: https:/ /review. openstack. org/512853 /git.openstack. org/cgit/ openstack/ oslo.log/ commit/ ?id=6b0b386146e 48470d889e0f1b2 2c7a5d5798149c
Committed: https:/
Submitter: Zuul
Branch: master
commit 6b0b386146e4847 0d889e0f1b22c7a 5d5798149c
Author: Zane Bitter <email address hidden>
Date: Mon Oct 16 16:41:44 2017 -0400
Allow logging of unhashable exceptions in Python 3
A bug in the Python 3 standard library, /bugs.python. org/issue28603 means that calling the traceback
https:/
module with an exception chain that includes an unhashable exception
results in a TypeError being raised. (In Python 3, any classes that
define __eq__() without also explicitly defining - not inheriting -
__hash__() will be unhashable.) The TypeError itself is also part of
such a chain, since its __context__ will be the unhashable exception. If
we don't catch it then the thread will simply exit mysteriously, and no
amount of logging will be able to reveal to the user what happened.
Change-Id: I6768574f38b075 c15e829df5593a4 5c6be66b1bc
Closes-Bug: #1724366