[Python-Dev] Baffled by PyArg_ParseTupleAndKeywords modification

"Martin v. Löwis" martin at v.loewis.de
Wed Feb 15 01:25:15 CET 2006

Jeremy Hylton wrote:
>>Perhaps there is some value in finding functions which ought to expect
>>const char*. For that, occasional checks should be sufficient; I cannot
>>see a point in having code permanently pass with that option. In
>>particular not if you are interfacing with C libraries.
> I don't understand what you mean:  I'm not sure what you mean by
> "occasional checks" or "permanently pass".  The compiler flags are
> always the same.

I'm objecting to the "this warning should never occur" rule. If the
warning is turned on in a regular build, then clearly it is desirable
to make it go away in all cases, and add work-arounds to make it
go away if necessary.

This is bad, because it means you add work-arounds to code where
really no work-around is necessary (e.g. because it is *known* that
some function won't modify the storage behind a char*, even though
it doesn't take a const char*). So it is appropriate that the
warning generates many false positives. Therefore, it should be
a manual interaction to turn this warning on, inspect all the
messages, and fix those that need correction, then turn the warning
off again.


More information about the Python-Dev mailing list