Update of /cvsroot/mahogany/M/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28967/src/Python

Modified Files:
        InitPython.cpp PythonHelp.cpp 
Log Message:
check that Python is not only configured but really initialized before calling Python 
functions

Index: InitPython.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/Python/InitPython.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -b -u -2 -r1.41 -r1.42
--- InitPython.cpp      18 Sep 2004 19:01:04 -0000      1.41
+++ InitPython.cpp      18 Sep 2004 22:06:52 -0000      1.42
@@ -65,4 +65,10 @@
 
 extern bool
+IsPythonInitialized()
+{
+   return gs_isPythonInitialized;
+}
+
+extern bool
 InitPython(void)
 {

Index: PythonHelp.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/Python/PythonHelp.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -b -u -2 -r1.38 -r1.39
--- PythonHelp.cpp      18 Sep 2004 20:19:04 -0000      1.38
+++ PythonHelp.cpp      18 Sep 2004 22:06:52 -0000      1.39
@@ -34,4 +34,5 @@
 
 #include "MPython.h"
+#include "InitPython.h"
 
 #include "Mdefaults.h"
@@ -87,5 +88,5 @@
 {
    // first check if Python is not disabled
-   if ( !READ_APPCONFIG(MP_USEPYTHON) )
+   if ( !IsPythonInitialized() )
       return def;
 
@@ -132,4 +133,11 @@
    }
 
+   if ( !IsPythonInitialized() )
+   {
+      ERRORMESSAGE((_("Cannot call Python function because Python interpreter "
+                      "failed to start up.")));
+      return false;
+   }
+
    // next determine which module should we load the function from
    String functionName = func;



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to