Ethan Furman <et...@stoneleaf.us> added the comment: >> During handling of the above exception, another exception occurred: >> >> This is a blatant falsehood -- another exception did not occur, a >> different exception was raised. > > This doesn't make any difference in any other context, so why would it > here?
I'm not sure I understand what you are saying -- could you rephrase? > By the way, this is all described in detail in a PEP: > http://www.python.org/dev/peps/pep-3134/ Yes, I know -- and from the PEP: Rationale The Python-Dev discussions revealed interest in exception chaining for two quite different purposes. To handle the unexpected raising of a secondary exception, the exception must be retained implicitly. To support intentional translation of an exception, there must be a way to chain exceptions explicitly. This PEP addresses both. Open Issue: Suppressing Context As written, this PEP makes it impossible to suppress '__context__', since setting exc.__context__ to None in an 'except' or 'finally' clause will only result in it being set again when exc is raised. The two motivations are excellent, and I have no issue with them; what I have issue with is that it is no longer possible to discard previous context. If I want to change the error message, I can use except ValueError as exc: raise AttributeError("blah") from exc and then get The above exception was the direct cause of the following exception I would also like to see: except ValueError as exc: raise AttributeError("blah") with exc to get During handling of the above exception, another exception occurred which would be the same as: 1/0 to get During handling of the above exception, another exception occurred and, finally, if all I have is except ValueError as exc: raise AttributeError("blah") I just get the normal, previous context free, traceback. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6210> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com