gh-102778: Add sys.last_exc, deprecate sys.last_type, sys.last_value,sys.last_traceback by iritkatriel · Pull Request #102779 · python/cpython
Please revert the changes to idlelib. (Why the rush before I could respond.) I dislike the awkward workaround changes, which IDLE does not need, and they cannot be backported. I would much prefer to make more extensive changes that get rid of nearly all references to the deprecated attributes and which can be backported.
For instance, in test_stackviewer setup, replace svs.last_type ... = svs.exec_info() with svs.last_exc = svs.exec_info()[1]. In the teardown, replace del ... with del svs.last_exc, leaving no usage of the deprecated names. In other modules, add sys.last_exc = sys.last_value and eliminate all other uses of the old names. In June 2024, eliminate the use of last_value.
Let me request again (from the previous PR that was closed) that idlelib changes be put in a separate PR that I can review and backport.