]> granicus.if.org Git - python/commitdiff
Patch #900727: Add Py_InitializeEx to allow embedding without signals.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 19 Aug 2004 11:31:58 +0000 (11:31 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 19 Aug 2004 11:31:58 +0000 (11:31 +0000)
Doc/api/init.tex
Include/pythonrun.h
Misc/NEWS
Python/pythonrun.c

index 4057f2fef137a9e57adea91211fae0c346b130be..ba961242d7d42a0fa9c228ba674468888735bcb2 100644 (file)
   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()}
index 88ceea33385a0496efdf274274555624c5addc9f..145c009303bd9c8dd301a67a4e2deec98b032b8f 100644 (file)
@@ -23,6 +23,7 @@ PyAPI_FUNC(void) Py_SetPythonHome(char *);
 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);
index f8f5088b944b5143995ec2aca912db117973c5fd..1c72294d501899556a1c0c47fa6d4b2adb6ceb77 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.4 alpha 3?
 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.
 
index 4d03229f22967fa84d3b4b1f814b2e0d1ac2342e..917f2be00b0eb61e96d2e8cdb773101a4912b83a 100644 (file)
@@ -131,7 +131,7 @@ add_flag(int flag, const char *envs)
 }
 
 void
-Py_Initialize(void)
+Py_InitializeEx(int install_sigs)
 {
        PyInterpreterState *interp;
        PyThreadState *tstate;
@@ -208,7 +208,8 @@ Py_Initialize(void)
 
        _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 @@ Py_Initialize(void)
 #endif
 }
 
+void
+Py_Initialize(void)
+{
+       Py_InitializeEx(1);
+}
+
+
 #ifdef COUNT_ALLOCS
 extern void dump_counts(void);
 #endif