[Freeipa-devel] [PATCH] jderose 002 - Fix #498088

Jason Gerard DeRose jderose at redhat.com
Tue Apr 28 22:04:54 UTC 2009


This patch fixes #498088:

  https://bugzilla.redhat.com/show_bug.cgi?id=498088

Under Python2.4 SystemExit subclasses from Exception (rather than from
BaseException like in Python2.5), so cli.run() was catching a SystemExit
raised by optparse.

This patch changes cli.run() so it catches all StandardError instead of
all Exception.  I've been pretty good about doing this correctly, but I
guess I missed this one.

To reiterate the correct use: all custom exceptions should subclass from
StandardError instead of Exception, and if doing a catch-all try/except,
you should almost always do an `except StandardError` instead of `except
Exception`.

See the exception class hierarchy at the bottom each of these pages:

  http://www.python.org/doc/2.4.4/lib/module-exceptions.html

  http://www.python.org/doc/2.5.4/lib/module-exceptions.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-jderose-002-fix-cli.run-under-python24.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090428/bdcfaa74/attachment.bin>


More information about the Freeipa-devel mailing list