New submission from daniel hahler <python-b...@thequod.de>: Currently Pdb.user_exception does not store the traceback in "user_exception", but only passes it to `interaction`:
def user_exception(self, frame, exc_info): """This function is called if an exception occurs, but only if we are to stop at or just below this level.""" if self._wait_for_mainpyfile: return exc_type, exc_value, exc_traceback = exc_info frame.f_locals['__exception__'] = exc_type, exc_value … self.interaction(frame, exc_traceback) I think it would be useful to have the whole exception info at hand in the debugger (via the frame locals) directly. If backward compatible is important it should use a new name for this maybe (`__excinfo__`), i.e. if current code would assume `__exception__` to be of length 2 only. But on the other hand this only affects extensions to the debugger, and not "real" programs, and therefore backward compatibility is not really required here? Currenly pdb extensions (e.g. pdbpp) can get it either by going up in the stack, or grabbing it via `interaction`, but this issue is mainly about making it available in plain pdb for the user to interact with. Code ref: https://github.com/python/cpython/blob/e8113f51a8bdf33188ee30a1c038a298329e7bfa/Lib/pdb.py#L295-L301 ---------- components: Library (Lib) messages: 340512 nosy: blueyed priority: normal severity: normal status: open title: pdb: store whole exception information in locals (via user_exception) versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36663> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com