summaryrefslogtreecommitdiff
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-10-17 15:14:19 -0700
committerSerhiy Storchaka <storchaka@gmail.com>2017-10-18 01:14:19 +0300
commit2712247ec94dcc12cf9abeec78f18f54fcc3357a (patch)
tree75e8771fb391d7f199ed20cc464cb93724b72f39 /Lib/traceback.py
parent858ea4354fafa36e57859d2dfd70f8a057984075 (diff)
downloadcpython-git-2712247ec94dcc12cf9abeec78f18f54fcc3357a.tar.gz
[3.6] bpo-28603: Fix formatting tracebacks for unhashable exceptions (GH-4014) (#4024)
(cherry picked from commit de86073a761cd3539aaca6f886a1f55effc0d9da)
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 09bda717ad..41fefff9c2 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -459,11 +459,11 @@ class TracebackException:
# Handle loops in __cause__ or __context__.
if _seen is None:
_seen = set()
- _seen.add(exc_value)
+ _seen.add(id(exc_value))
# Gracefully handle (the way Python 2.4 and earlier did) the case of
# being called with no type or value (None, None, None).
if (exc_value and exc_value.__cause__ is not None
- and exc_value.__cause__ not in _seen):
+ and id(exc_value.__cause__) not in _seen):
cause = TracebackException(
type(exc_value.__cause__),
exc_value.__cause__,
@@ -475,7 +475,7 @@ class TracebackException:
else:
cause = None
if (exc_value and exc_value.__context__ is not None
- and exc_value.__context__ not in _seen):
+ and id(exc_value.__context__) not in _seen):
context = TracebackException(
type(exc_value.__context__),
exc_value.__context__,