[crossfire] current plugins with python 2.2?

Mark Wedel mwedel at sonic.net
Sun Sep 17 23:14:48 CDT 2006


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.c	27 Aug 2006 14:11:34 -0000	1.37
> +++ cfpython.c	29 Aug 2006 20:42:42 -0000
> @@ -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 at metalforge.org
> http://mailman.metalforge.org/mailman/listinfo/crossfire




More information about the crossfire mailing list