no longer crashes on mangled console.py and other python initialisation errors.

This commit is contained in:
Lieuwe 2011-03-18 17:23:08 +01:00
parent 9c39875ef0
commit 8b22ca5064
4 changed files with 37 additions and 28 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -30,6 +30,7 @@
#include "Python.h"
#include "pyconsole.h"
//#include "pystdlib.h"
char pyready=1;
#endif
#include <stdio.h>
@ -2090,7 +2091,8 @@ int main(int argc, char *argv[])
{
PyErr_Print();
printf("unable to find handle function, mangled console.py?\n");
return -1;
//return -1;
pyready=0;
}
pstep=PyObject_GetAttrString(pmodule,"step");//get the handler function
@ -2118,7 +2120,8 @@ int main(int argc, char *argv[])
//sys.stderr
PyErr_Print();
printf("unable to find console module, missing file or mangled console.py?\n");
return -1;
//return -1;
pyready=0;
}
#else
printf("python console disabled at compile time.");
@ -2748,6 +2751,7 @@ int main(int argc, char *argv[])
}
}
#ifdef PYCONSOLE
if(pyready==1)
if(pkey!=NULL && sdl_key!=NULL)
{
pargs=Py_BuildValue("(c)",sdl_key);
@ -3660,6 +3664,8 @@ int main(int argc, char *argv[])
if(console_mode)
{
#ifdef PYCONSOLE
if(pyready==1)
{
char *console;
//char error[255] = "error!";
sys_pause = 1;
@ -3674,6 +3680,9 @@ int main(int argc, char *argv[])
free(console);
if(!console_mode)
hud_enable = 1;
}
else
console_mode=0;
#else
console_mode=0;
#endif
@ -3681,6 +3690,7 @@ int main(int argc, char *argv[])
//execute python step hook
#ifdef PYCONSOLE
if(pyready==1)
if(pstep!=NULL)
{
pargs=Py_BuildValue("()");

View File

@ -17,7 +17,6 @@ if(DEBUG==False):
sys.stdout=logger()
sys.stderr=logger()
element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
"nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
"snow":16,"wood":17,"neut":18,"plut":19,"plnt":20,"acid":21,"void":22,