Skip to content

Instantly share code, notes, and snippets.

View iritkatriel's full-sized avatar

Irit Katriel iritkatriel

View GitHub Profile
@iritkatriel
iritkatriel / exc_info
Last active January 11, 2022 01:49
Towards removing the exc_info triplet from Python's API
Following recent work [https://bugs.python.org/issue45711], the interpreter's internal
representation of the active exception (sys.exc_info()) is no longer the (typ, val, tb)
triplet, but just the exception instance.
For backward compatibility, existing APIs reconstruct the triplet from the instance, so
for example ``sys.exc_info()`` returns the triplet ``(type(exc), exc, exc.__traceback__)``,
where ``exc`` is the active exception.
Removing the triplet representation entirely is not something we can realistically
do anytime soon. However, it is feasible to reach a state where the triplet need not