[Zope3-dev] Re: [Zope-dev] Re: tal:on-error is a bare except...

Jim Fulton jim at zope.com
Mon Aug 23 14:42:41 EDT 2004


Tres Seaver wrote:
> Jim Fulton wrote:
> 

...

>> Hm. I wonder if SystemError would be appropriate here.
>> (Zope may abuse SystemError, but we could fix that.)
> 
> 
> RuntimeError exists, but has the wrong bases (StandardError, which 
> derives from Exception).  SystemError has StandardError as its base, too.

I'm not trying to solve the problem of making an exception uncatchable.
If we said that RuntimeError or SystemError (or whatever) shouldn't
be caught by a bare excpt, then we could, with present Python
say that the following is the correct idiom for a bare except:

   try:
       ...
   except:
       if isinstance(sys.exc_info()[1], RuntimeError):
           raise
       ... do what we do for ctachable errors

Jim


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list