[Python-checkins] gh-102778: IDLE - make sys.last_exc available in Shell after traceback (#103314)

terryjreedy webhook-mailer at python.org
Wed Apr 19 01:06:00 EDT 2023


https://github.com/python/cpython/commit/d1e4917e06d5638f1a7fa189d6d63ec9c2a27753
commit: d1e4917e06d5638f1a7fa189d6d63ec9c2a27753
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: terryjreedy <tjreedy at udel.edu>
date: 2023-04-19T01:05:52-04:00
summary:

gh-102778: IDLE - make sys.last_exc available in Shell after traceback (#103314)

---------
Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>

files:
A Misc/NEWS.d/next/Library/2023-04-06-16-55-51.gh-issue-102778.BWeAmE.rst
M Lib/idlelib/run.py

diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 577c49eb67b2..04ce615621ee 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -239,6 +239,7 @@ def print_exception():
     efile = sys.stderr
     typ, val, tb = excinfo = sys.exc_info()
     sys.last_type, sys.last_value, sys.last_traceback = excinfo
+    sys.last_exc = val
     seen = set()
 
     def print_exc(typ, exc, tb):
diff --git a/Misc/NEWS.d/next/Library/2023-04-06-16-55-51.gh-issue-102778.BWeAmE.rst b/Misc/NEWS.d/next/Library/2023-04-06-16-55-51.gh-issue-102778.BWeAmE.rst
new file mode 100644
index 000000000000..64ae5b5b6d56
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-04-06-16-55-51.gh-issue-102778.BWeAmE.rst
@@ -0,0 +1 @@
+Support ``sys.last_exc`` in :mod:`idlelib`.



More information about the Python-checkins mailing list