[libpeas] [Python] Use Py_InitializeEx()



commit aedcfeddbb76e9b6ca7b005a7b64155f9425f16e
Author: Steve Frécinaux <code istique net>
Date:   Fri Jun 25 01:34:01 2010 +0200

    [Python] Use Py_InitializeEx()
    
    As per the comment present in the code, we are actually reproducing in
    the loader what Py_InitializeEx(FALSE) gives us for free. Let's just use
    that.

 configure.ac                               |    1 -
 loaders/python/peas-plugin-loader-python.c |   36 +---------------------------
 2 files changed, 1 insertions(+), 36 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 020022a..72d80f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,6 @@ LT_INIT([disable-static])
 
 
 AC_CHECK_FUNCS(fsync)
-AC_CHECK_FUNC(sigaction)
 AC_CHECK_SIZEOF(time_t, [], [#include <time.h>])
 
 PKG_PROG_PKG_CONFIG
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 0eee9a1..7d5f610 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -364,10 +364,6 @@ peas_python_init (PeasPluginLoaderPython *loader)
 {
   PyObject *mdict, *gobject, *gettext, *install, *gettext_args;
   char *argv[] = { "libpeas", NULL };
-#ifdef HAVE_SIGACTION
-  struct sigaction old_sigint;
-  gint res;
-#endif
 
   if (loader->priv->init_failed)
     {
@@ -387,38 +383,8 @@ peas_python_init (PeasPluginLoaderPython *loader)
      ends with success */
   loader->priv->init_failed = TRUE;
 
-  /* Hack to make python not overwrite SIGINT: this is needed to avoid
-   * the crash reported on bug #326191 */
-
-  /* CHECK: can't we use Py_InitializeEx instead of Py_Initialize in order
-     to avoid to manage signal handlers ? - Paolo (Dec. 31, 2006) */
-
-#ifdef HAVE_SIGACTION
-  /* Save old handler */
-  res = sigaction (SIGINT, NULL, &old_sigint);
-  if (res != 0)
-    {
-      g_warning ("Error initializing Python interpreter: cannot get "
-                 "handler to SIGINT signal (%s)", g_strerror (errno));
-
-      return FALSE;
-    }
-#endif
-
   /* Python initialization */
-  Py_Initialize ();
-
-#ifdef HAVE_SIGACTION
-  /* Restore old handler */
-  res = sigaction (SIGINT, &old_sigint, NULL);
-  if (res != 0)
-    {
-      g_warning ("Error initializing Python interpreter: cannot restore "
-                 "handler to SIGINT signal (%s).", g_strerror (errno));
-
-      goto python_init_error;
-    }
-#endif
+  Py_InitializeEx (FALSE);
 
   PySys_SetArgv (1, argv);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]