Commit 58390be1 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Avoid segfaults with buggy pythons.

2001-08-28  Morten Welinder  <terra@diku.dk>

	* python-loader.c (initialize_python_if_needed): Avoid segfaults
 	with buggy pythons.
parent d48e13b0
......@@ -14,6 +14,8 @@ Jukka:
Morten:
* Speed up font handling a bit.
* Speed up dependency handling.
* Fix the python loader. (Work around mind-boggling bug in
python. Again.)
Zbigniew:
* Support for translations in plugin.xml files using xml-i18n-tools
......
2001-08-28 Morten Welinder <terra@diku.dk>
* python-loader.c (initialize_python_if_needed): Avoid segfaults
with buggy pythons.
2001-08-21 Zbigniew Chyla <cyba@gnome.pl>
* plugin.xml: Removed
......
......@@ -26,6 +26,9 @@
#include "module-plugin-defs.h"
#include "py-gnumeric.h"
#define BROKEN_PY_INITIALIZE
GNUMERIC_MODULE_PLUGIN_INFO_DECL;
GtkType python_get_loader_type (ErrorInfo **ret_error);
......@@ -69,12 +72,25 @@ static void gnumeric_plugin_loader_python_load_service_function_group (GnumericP
static void gnumeric_plugin_loader_python_unload_service_function_group (GnumericPluginLoader *loader, PluginService *service, ErrorInfo **ret_error);
#ifdef BROKEN_PY_INITIALIZE
extern char **environ;
#endif
static void
initialize_python_if_needed (void)
{
static gboolean python_initialized = FALSE;
if (!python_initialized) {
#ifdef BROKEN_PY_INITIALIZE
int i;
/* Python's convertenviron has gotten into its head that it can
write to the strings in the environment. We have little choice
but to allocate a copy of everything. */
for (i = 0; environ[i]; i++)
environ[i] = g_strdup (environ[i]);
#endif
Py_Initialize ();
PyEval_InitThreads ();
python_initialized = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment