[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

Jack Jansen Jack.Jansen at cwi.nl
Tue Feb 14 13:59:31 CET 2006

Thanks to all for a rather insightful discussion, it's always fun to  
learn that after 28 years of C programming the language still has  
little corners that I know absolutely nothing about:-)

Practically speaking, though, I've adopted MAL's solution for the  
time being:

> /* The keyword array changed to const char* in Python 2.5 */
> #if PY_VERSION_HEX >= 0x02050000
> # define Py_KEYWORDS_STRING_TYPE const char
> #else
> # define Py_KEYWORDS_STRING_TYPE char
> #endif
> ...
> static Py_KEYWORDS_STRING_TYPE *kwslist[] = {"yada", NULL};
> ...
> if (!PyArg_ParseTupleAndKeywords(args,kws,format,kwslist,&a1))
>     goto onError;

At least this appears to work...
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  

More information about the Python-Dev mailing list