Mercurial > cpython-lru_cache-weakref
changeset 33189:de804edf8bcd legacy-trunk
Patch #900727: Add Py_InitializeEx to allow embedding without signals.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 19 Aug 2004 11:31:58 +0000 |
| parents | 0feccf19b16d |
| children | b0f2681bcf7f |
| files | Doc/api/init.tex Include/pythonrun.h Misc/NEWS Python/pythonrun.c |
| diffstat | 4 files changed, 20 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Doc/api/init.tex Thu Aug 19 11:07:49 2004 +0000 +++ b/Doc/api/init.tex Thu Aug 19 11:31:58 2004 +0000 @@ -23,6 +23,13 @@ no return value; it is a fatal error if the initialization fails. \end{cfuncdesc} +\begin{cfuncdesc}{void}{Py_InitializeEx}{int initsigs} + This function works like \cfunction{Py_Initialize} if + \var{initsigs} is 1. If \var{initsigs} is 0, it skips + initialization registration of signal handlers, which + might be useful when Python is embedded. \versionadded{2.4} +\end{cfuncdesc} + \begin{cfuncdesc}{int}{Py_IsInitialized}{} Return true (nonzero) when the Python interpreter has been initialized, false (zero) if not. After \cfunction{Py_Finalize()}
--- a/Include/pythonrun.h Thu Aug 19 11:07:49 2004 +0000 +++ b/Include/pythonrun.h Thu Aug 19 11:31:58 2004 +0000 @@ -23,6 +23,7 @@ PyAPI_FUNC(char *) Py_GetPythonHome(void); PyAPI_FUNC(void) Py_Initialize(void); +PyAPI_FUNC(void) Py_InitializeEx(int); PyAPI_FUNC(void) Py_Finalize(void); PyAPI_FUNC(int) Py_IsInitialized(void); PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
--- a/Misc/NEWS Thu Aug 19 11:07:49 2004 +0000 +++ b/Misc/NEWS Thu Aug 19 11:31:58 2004 +0000 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Py_InitializeEx has been added. + - Fix the order of application of decorators. The proper order is bottom-up; the first decorator listed is the last one called.
--- a/Python/pythonrun.c Thu Aug 19 11:07:49 2004 +0000 +++ b/Python/pythonrun.c Thu Aug 19 11:31:58 2004 +0000 @@ -131,7 +131,7 @@ } void -Py_Initialize(void) +Py_InitializeEx(int install_sigs) { PyInterpreterState *interp; PyThreadState *tstate; @@ -208,7 +208,8 @@ _PyImportHooks_Init(); - initsigs(); /* Signal handling stuff, including initintr() */ + if (install_sigs) + initsigs(); /* Signal handling stuff, including initintr() */ initmain(); /* Module __main__ */ if (!Py_NoSiteFlag) @@ -276,6 +277,13 @@ #endif } +void +Py_Initialize(void) +{ + Py_InitializeEx(1); +} + + #ifdef COUNT_ALLOCS extern void dump_counts(void); #endif
