summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-03-18 11:47:11 (GMT)
committerGitHub <noreply@github.com>2023-03-18 11:47:11 (GMT)
commite1e9bab0061e8d4bd7b94ed455f3bb7bf8633ae7 (patch)
tree8363c72cc70b34e06fed5c39d86ec99047613799 /Lib/dis.py
parent039714d00f147be4d018fa6aeaf174aad7e8fa32 (diff)
downloadcpython-e1e9bab0061e8d4bd7b94ed455f3bb7bf8633ae7.zip
cpython-e1e9bab0061e8d4bd7b94ed455f3bb7bf8633ae7.tar.gz
cpython-e1e9bab0061e8d4bd7b94ed455f3bb7bf8633ae7.tar.bz2
gh-102778: Add sys.last_exc, deprecate sys.last_type, sys.last_value,sys.last_traceback (#102779)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 9edde6a..c3d152b 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -118,7 +118,10 @@ def distb(tb=None, *, file=None, show_caches=False, adaptive=False):
"""Disassemble a traceback (default: last traceback)."""
if tb is None:
try:
- tb = sys.last_traceback
+ if hasattr(sys, 'last_exc'):
+ tb = sys.last_exc.__traceback__
+ else:
+ tb = sys.last_traceback
except AttributeError:
raise RuntimeError("no last traceback to disassemble") from None
while tb.tb_next: tb = tb.tb_next