[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

Jeremy Hylton jeremy at alum.mit.edu
Fri Feb 10 19:32:51 CET 2006

On 2/10/06, Guido van Rossum <guido at python.org> wrote:
> On 2/10/06, Tim Peters <tim.peters at gmail.com> wrote:
> >     [Jeremy]
> >     I added some const to several API functions that take char* but
> >     typically called by passing string literals.
> >
> > If he had _stuck_ to that, we wouldn't be having this discussion :-)
> > (that is, nobody passes string literals to
> > PyArg_ParseTupleAndKeywords's kws argument).
> Is it too late to revert this one?

The change is still beneficial to C++ programmers, so my initial
preference is to keep it.  There are still some benefits to the other
changes, so it's isn't a complete loss if we revert it.

> Is there another way to make C++ programmers happy (e.g. my having a
> macro that expands to const when compiled with C++ but vanishes when
> compiled with C?)

Sounds icky.  Are we pretty sure there is no way to do the right thing
in plain C?  That is, declare the argument as taking a set of const
strings and still allow non-const strings to be passed without


More information about the Python-Dev mailing list