summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-05-01 17:19:47 (GMT)
committerGitHub <noreply@github.com>2023-05-01 17:19:47 (GMT)
commita679c3d58d10aafd9ac9355fdd16151607e37d65 (patch)
treef02589aec2f9f81c5bc2c2f744d1c71f8e1493e7 /Lib/inspect.py
parent2a884ceb36e799c900129d4b5b6248262004efb5 (diff)
downloadcpython-a679c3d58d10aafd9ac9355fdd16151607e37d65.zip
cpython-a679c3d58d10aafd9ac9355fdd16151607e37d65.tar.gz
cpython-a679c3d58d10aafd9ac9355fdd16151607e37d65.tar.bz2
gh-102799: replace sys.exc_info by sys.exception in inspect and traceback modules (#104032)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 6d1d7b7..92c2675 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1766,7 +1766,9 @@ def stack(context=1):
def trace(context=1):
"""Return a list of records for the stack below the current exception."""
- return getinnerframes(sys.exc_info()[2], context)
+ exc = sys.exception()
+ tb = None if exc is None else exc.__traceback__
+ return getinnerframes(tb, context)
# ------------------------------------------------ static version of getattr