Message48295
Logged In: YES
user_id=1044177
Again, I think this should be explicitly exclusive to an
embedding application, as I cannot imagine a situation where
an extension module should even have access to this facility.
I have done rather limited tests. My application doesn't
seem to like Python 2.5alpha, so I'm going to test the patch
against 2.4.
Sorry to butt into your patch, mutkuk, but here's my
recommendation with docs(ugh, cant attach files):
Index: Doc/api/init.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v
retrieving revision 1.23
diff -r1.23 init.tex
39a40,53
>
\begin{cfuncdesc}{void}{Py_InitializeFatalHook}{PyFatalHook fp}
> Force \cfunction{Py_FatalError()} to invoke the given
function
> instead of printing to standard error and aborting out
of the
> process. This is intended for use in embedded
applications that
> want to define their own route for handling fatal
errors. Giving
> the application the ability to log the error to a special
> destination, and to do any appropriate cleanups before
exiting.
>
> If used, this \emph{must} be called prior to
> \cfunction{Py_Initialize()}. Otherwise,
\cfunction{Py_Initialize()}
> will set the hook to the default, and future attempts to
> \cfunction{Py_InitializeFatalHook()} will be ignored.
> \end{cfuncdesc}
>
Index: Include/pythonrun.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v
retrieving revision 2.65
diff -r2.65 pythonrun.h
24a25,27
> typedef void (*PyFatalHook)(const char *);
> PyAPI_FUNC(void) Py_InitializeFatalHook(PyFatalHook);
>
Index: Python/pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.213
diff -r2.213 pythonrun.c
99a100,109
> static PyFatalHook _fatalhook = NULL;
>
> void
> Py_InitializeFatalHook(PyFatalHook f)
> {
> /* Only set it if it is uninitialized. */
> if (_fatalhook == NULL)
> _fatalhook = f;
> }
>
150a161,162
> Py_InitializeFatalHook(Py_FatalError);
>
1507a1520,1523
> if (_fatalhook != Py_FatalError && _fatalhook != NULL)
> _fatalhook(msg);
> /* If the hook fell through, finish the process anyways. */
> |
|
Date |
User |
Action |
Args |
2007-08-23 15:42:53 | admin | link | issue1195571 messages |
2007-08-23 15:42:53 | admin | create | |
|