[Python-Dev] Chained Exceptions
Guido van Rossum
gvanrossum at gmail.com
Fri May 13 03:27:33 CEST 2005
[Phillip J. Eby]
> I think the main problem is going to be that (IIUC), Python doesn't "know"
> when you've exited an 'except:' clause and are therefore no longer
> handling the exception.
But the compiler knows and could insert code to maintain this state.
> sys.exc_info() still gives you the exception you
> just caught. I think that a lot of the questions Guido brought up are
> directly related to this.
Right.
> Also, what about code like this:
>
> try:
> doSomething()
> except SomeError:
> pass
>
> doSomethingElse()
>
> Should exceptions raised by doSomethingElse()' be treated as having the
> SomeError as their context, if it was raised?
>
> If I understand correctly, the interpreter cannot currently distinguish
> between this, and the case where an error is raised inside the 'except' clause.
Indeed the interpreter currently doesn't distinguish between these,
but I think it ought to for the purposes of this proposal.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list