Catching a segfault in a Python library

Paul Rubin http
Sat Nov 24 21:26:44 CET 2007


Donn Ingle <donn.ingle at gmail.com> writes:
> runapp
>  result = runActualApp( )
>  while True:
>   if result == allokay: break
>   else: 
>    <Start handling the horror>
> 
> Unless a segfault goes through that too, like Krypton through Superman.

No you can't do it that way, when I say "run it under a debugger", I
mean run the entire Python interpreter under something like gdb, and
actually debug the seg fault.  I can understand if you're reluctant to
make that effort.  If it's for something critical then you should
certainly do it.  If it's for something exposed to the internet or
used by potentially malicious users then you should certainly do it.
If it's for something throwaway and exposed only to trusted users,
then maybe your trap-and-restart approach can keep things usable for a
while.



More information about the Python-list mailing list