[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification (original) (raw)

Tim Peters tim.peters at gmail.com
Fri Feb 10 18:19:01 CET 2006


[Jeremy Hylton]

... I admit that I'm also puzzled by Jack's specific question. I don't understand why an array passed to PyArgParseTupleAndKeywords() would need to be declared as const. I observed the problem in my initial changes but didn't think very hard about the cause of the problem. Perhaps someone with better C/C++ standards chops can explain.

Oh, who cares? I predict "Jack's problem" would go away if we changed the declaration of PyArg_ParseTupleAndKeywords to what you intended to begin with:

PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, const char *, const char * const *, ...);

That is, declare the keywords argument as a pointer to const pointer to const char, rather than the current pointer to pointer to const char.

How about someone on a Linux box try that with gcc, and check it in if it solves Jack's problem (meaning that gcc stops whining about the original spelling of his original example).



More information about the Python-Dev mailing list