[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

Armin Rigo arigo at tunes.org
Sat Feb 11 21:57:35 CET 2006


Hi Tim,

On Fri, Feb 10, 2006 at 12:19:01PM -0500, Tim Peters wrote:
> Oh, who cares?  I predict "Jack's problem" would go away if we changed
> the declaration of PyArg_ParseTupleAndKeywords to what you intended
> <wink> to begin with:
> 
> PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
>                                                   const char *, const
> char * const *, ...);

Alas, this doesn't make gcc happy either.  (I'm trying gcc 3.4.4.)  In
theory, it prevents the const-bypassing trick showed by Martin, but
apparently the C standard (or gcc) is not smart enough to realize that.

I don't see a way to spell it in C so that the same extension module
compiles with 2.4 and 2.5 without a warning, short of icky macros.


A bientot,

Armin


More information about the Python-Dev mailing list