summaryrefslogtreecommitdiff
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2017-10-17 17:29:39 -0400
committerSerhiy Storchaka <storchaka@gmail.com>2017-10-18 00:29:39 +0300
commitde86073a761cd3539aaca6f886a1f55effc0d9da (patch)
tree8277693d0d29d8b9cbe06449c9d048fb0aadfe9b /Lib/traceback.py
parent191e3138200906e43cba9347177914325b54843f (diff)
downloadcpython-git-de86073a761cd3539aaca6f886a1f55effc0d9da.tar.gz
bpo-28603: Fix formatting tracebacks for unhashable exceptions (#4014)
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 fb3bce12a1..ee8c739140 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -458,11 +458,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__,
@@ -474,7 +474,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__,