Guido van Rossum wrote: > [Brett C.] > >>Maybe, but as long as caught exceptions get cleared that should be an issue. >>Would this be solved if, when an 'except' branch is exited, exceptions are >>cleared? So, in the above example, once the 'pass' is hit in catchit() no >>exception is considered active any longer. This could be done with a >>CLEAR_EXC >>opcode very easily inserted at the end of an 'except' branch by the compiler. > > > Sure, but that would be backwards incompatible.
Right. None of what I am discussing here I would expect to be implemented any sooner than Python 3000. > There's plenty of code > that expects sys.exc_info() to continue to return the caught exception > *outside* the except block. This is all incredibly tricky, to some > extent for backwards compatibility reasons (please read the source > code for maintaining the exc_info data!). > > In Python 3000, I think we can get rid of sys.exc_info() altogether > once we place the traceback in the exception object as the 'traceback' > attribute: if you want this info, all you need is write > > except SomeException, err: > # now type is err.__class__, value is err, and traceback is > err.traceback. > Right, that is kind of the end goal in my mind. > If you want to have this with an "except:" clause, you can just catch > 'Exception' or perhaps 'BaseException'. This isn't possible in Python > 2.x since there's no single base class. > Right. Once again I am only thinking about Python 3000. -Brett _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com