New submission from Irit Katriel <iritkatr...@gmail.com>:
Following to changes in issue45711, the interpreter's internal representation of the active exception is just the exception instance (the exc_type and exc_traceback fields were removed). For backwards compatibility, sys.exc_info() constructs the (typ, val, tb) tuple from the instance and this will continue to be the case for some time because this tuple has leaked into quite a few APIs. However, now that the redundancy in the exc_info tuple is guaranteed by the way it's constructed, we can confidently add a sys.exception() method that returns just the exception instance (as suggested in PEP3134's section on future improvements). This small change will make a difference to learners because the (typ, val, tb) tuple looks quite cryptic to those who don't know about tracebacks, and the redundancy in it is confusing for those who do. ---------- assignee: iritkatriel messages: 410204 nosy: iritkatriel priority: normal severity: normal status: open title: add sys.exception() type: enhancement versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46328> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com