So python 2.4, 2.5, 2.6 and 3.1 all have different ideas about the
exception hierarchy is and what 'except Exception' will actually do.

2.4: Exception is the absolute root, and catching it (in order to
catch/ignore e.g. json parse errors) will also catch KeyboardInterrupt
and stuff like that.

2.5: Exception is now lower in the hierarchy, but it still is the parent
class for GeneratorExit and StopIteration

2.6/3.1: Exception is now almost in the right place, but it still wraps
things like SyntaxError (which one doesn't want to catch, ever).

We could try to declare in error.py the base class we want to catch
(e.g. StandardError for 2.4), but we can't rely on how the various
other modules will derive their exceptions (and our exceptions are too
derived from Exception).

The other choice would be to not use try... except directly in code that
needs to catch/ignore generic errors, but instead have a separate
function that re-raises bad things like SyntaxError, SystemExit,
KeyboardInterrupt, etc..

This is not urgent, but would be a good cleanup to perform.

iustin

Reply via email to