building release - assert-free python library

Ben Finney ben+python at
Tue Apr 7 12:30:53 CEST 2009

grbgooglefan <ganeshborse at> writes:

> I would like to avoid [exceptions] when compiling the libpython.a
> library because when this libpython gets used for production purpose
> and it aborts, the application goes down without any means of
> graceful handling that error condition. How can we handle this?

Exceptions are a fundamental control flow mechanism in Python, and
Python programs need them enabled in order to function properly.

What you actually want is (as you say) to properly handle any
un-caught exceptions. This is done by writing an exception handler
function and then binding the name ‘sys.excepthook’
<URL:> to your
function as the default exception handler.

 \        “Somebody told me how frightening it was how much topsoil we |
  `\   are losing each year, but I told that story around the campfire |
_o__)                             and nobody got scared.” —Jack Handey |
Ben Finney

More information about the Python-list mailing list