summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/code.py
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-02-16 11:51:30 +0100
committerGitHub <[email protected]>2024-02-16 11:51:30 +0100
commit506ecaee93b52cc12c2e2f97c3d42e3ca2a7f59e (patch)
treed096fb9eb988fbb0ca1ba970041773207ce3aa70 /contrib/tools/python3/src/Lib/code.py
parent4749b9e5d260714490997e6f5ee1ee8c1c8fc46c (diff)
parentf200f72c9d7a89c1018e3dc6b46c49fe2ecf84fb (diff)
Merge pull request #1940 from dcherednik/importlib
Library import 14
Diffstat (limited to 'contrib/tools/python3/src/Lib/code.py')
-rw-r--r--contrib/tools/python3/src/Lib/code.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/tools/python3/src/Lib/code.py b/contrib/tools/python3/src/Lib/code.py
index 76000f8c8b2..2bd5fa3e795 100644
--- a/contrib/tools/python3/src/Lib/code.py
+++ b/contrib/tools/python3/src/Lib/code.py
@@ -106,6 +106,7 @@ class InteractiveInterpreter:
"""
type, value, tb = sys.exc_info()
+ sys.last_exc = value
sys.last_type = type
sys.last_value = value
sys.last_traceback = tb
@@ -119,7 +120,7 @@ class InteractiveInterpreter:
else:
# Stuff in the right filename
value = SyntaxError(msg, (filename, lineno, offset, line))
- sys.last_value = value
+ sys.last_exc = sys.last_value = value
if sys.excepthook is sys.__excepthook__:
lines = traceback.format_exception_only(type, value)
self.write(''.join(lines))
@@ -138,6 +139,7 @@ class InteractiveInterpreter:
"""
sys.last_type, sys.last_value, last_tb = ei = sys.exc_info()
sys.last_traceback = last_tb
+ sys.last_exc = ei[1]
try:
lines = traceback.format_exception(ei[0], ei[1], last_tb.tb_next)
if sys.excepthook is sys.__excepthook__: