Re: [crossfire] current plugins with python 2.2?
That fixed the problem. I take it there is no bad effect of doing this for newer versions of python, so it should probably be committed by someone? Committing it when i get the time, then. Thanks for testing. Nicolas ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
Re: [crossfire] current plugins with python 2.2?
Nicolas Weeger (Laposte) wrote: 1) require newer version of python (as with python 2.2, it clear seems broken) 2) Look at python 2.2 doc and figure out if code can be modified to work with it. Hello. Here's a patch that may fix the issue (I haven't checked the docs, but that's an obvious thing to test ;p) That fixed the problem. I take it there is no bad effect of doing this for newer versions of python, so it should probably be committed by someone? Nicolas ? python.diff Index: cfpython.c === RCS file: /cvsroot/crossfire/crossfire/plugins/cfpython/cfpython.c,v retrieving revision 1.37 diff -u -r1.37 cfpython.c --- cfpython.c27 Aug 2006 14:11:34 - 1.37 +++ cfpython.c29 Aug 2006 20:42:42 - @@ -840,8 +840,11 @@ int value; } CFConstant; +static PyMethodDef CFConstantsMethods[] = { { NULL, NULL, 0 } }; + static void addConstants(PyObject* module, const char* name, CFConstant* constants) { + int i = 0; char tmp[1024]; PyObject* new; @@ -850,7 +853,7 @@ strncpy(tmp, Crossfire_, 1024); strncat(tmp, name, 1024 - strlen(tmp)); -new = Py_InitModule(tmp, NULL); +new = Py_InitModule(tmp, CFConstantsMethods); dict = PyDict_New(); while ( constants[i].name != NULL) ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire
Re: [crossfire] current plugins with python 2.2?
1) require newer version of python (as with python 2.2, it clear seems broken) 2) Look at python 2.2 doc and figure out if code can be modified to work with it. Hello. Here's a patch that may fix the issue (I haven't checked the docs, but that's an obvious thing to test ;p) Nicolas ? python.diff Index: cfpython.c === RCS file: /cvsroot/crossfire/crossfire/plugins/cfpython/cfpython.c,v retrieving revision 1.37 diff -u -r1.37 cfpython.c --- cfpython.c 27 Aug 2006 14:11:34 - 1.37 +++ cfpython.c 29 Aug 2006 20:42:42 - @@ -840,8 +840,11 @@ int value; } CFConstant; +static PyMethodDef CFConstantsMethods[] = { { NULL, NULL, 0 } }; + static void addConstants(PyObject* module, const char* name, CFConstant* constants) { + int i = 0; char tmp[1024]; PyObject* new; @@ -850,7 +853,7 @@ strncpy(tmp, Crossfire_, 1024); strncat(tmp, name, 1024 - strlen(tmp)); -new = Py_InitModule(tmp, NULL); +new = Py_InitModule(tmp, CFConstantsMethods); dict = PyDict_New(); while ( constants[i].name != NULL) ___ crossfire mailing list crossfire@metalforge.org http://mailman.metalforge.org/mailman/listinfo/crossfire