[Python-Dev] disappearing exceptions

Greg Ewing greg.ewing at canterbury.ac.nz
Wed May 21 02:19:42 CEST 2008


Christian Heimes wrote:
> Thankfully this issue was fixed in Python 2.6 and 3.0. In newer versions
> of Python hasattr() only swallows exception based on the Exception class
> but not BaseExceptions.

Shouldn't it only be catching AttributeError, though?

> We should make sure all code in the core behaves
> the same way. Exceptions based on BaseException must *never* be
> swallowed.

Seems to me that all code in the core that catches exceptions
should only be catching the exceptions it really needs
to catch. That requires looking at each case individually
rather than a blanket "catch Exception" recommendation
(although that might still be an improvement over the
status quo).

-- 
Greg


More information about the Python-Dev mailing list