[Python-Dev] Re-raise in absence of an "active" exception

"Martin v. Löwis" martin at v.loewis.de
Mon Jun 21 01:22:32 EDT 2004

http://python.org/sf/973103 points to two interesting bugs in Python:

First, using a re-raise after the except-block has completed will
still re-raise the last exception. Even though the language spec
is ambiguous (what is the "last expression that was active in the
current scope" (*)), I doubt this is intended.

It then also shows that the error you "normally" get for a reraise
in absence of an exception is

TypeError: exceptions must be classes, instances, or strings 
(deprecated), not NoneType

I think this is in violation of the language description, which says

"If no exception is active in the current scope, an exception is raised 
indicating this error."

"This" error probably being "no active exception", not "exception must
not be NoneType".

What do you think?


More information about the Python-Dev mailing list