[Python-Dev] Need to hook Py_FatalError

m.u.k m.u.k.2 at gawab.com
Tue May 3 19:44:10 CEST 2005


Guido van Rossum <gvanrossum at gmail.com> wrote in
news:ca471dc205050309156962d3ff at mail.gmail.com: 
> Your efforts would be better directed towards fixing the causes of the
> fatal errors.
> I see no need to hook Py_FatalError, but since it's open source, you
> are of course free to patch your own copy if your urge is truly
> irresistible. Or I guess you could run Python under supervision of gdb
> and trap it that way.

Well, I admit it is a bit triva(as its implementation), at least nobody 
wanted it within Python's 10+ lifetime. Indeed Im using my own patched copy,
I just thought it'd be good some other naughty boy playing dangerous games 
with interpreter internals not spend hours in debugger trying to reproduce 
the crash.

> But tell me, what do you want the process to do instead of
> terminating? Py_FatalError is used in situations where raising an
> exception is impossible or would do more harm than good.

The need for this is only logging purposes. eg the process just terminates 
on client machine, you have no logs, no clues(except a coredump), nightmare!.
Some sort of log would be invaluable here.

Best regards.

More information about the Python-Dev mailing list