[Python-Dev] GCC patch for catching errors in PyArg_ParseTuple

"Martin v. Löwis" martin at v.loewis.de
Fri Sep 22 22:21:35 CEST 2006


I wrote a patch for the GCC trunk to add an
__attribute__((format(PyArg_ParseTuple, 2, 3)))
declaration to functions (this specific declaration
should go to PyArg_ParseTuple only).

With that patch, parameter types are compared with the string parameter
(if that's a literal), and errors are reported if there is a type
mismatch (provided -Wformat is given).

I'll post more about this patch in the near future, and commit
some bug fixes I found with it, but here is the patch, in
a publish-early fashion.

There is little chance that this can go into GCC (as it is too
specific), so it likely needs to be maintained separately.
It was written for the current trunk, but hopefully applies
to most recent releases.

Regards,
Martin

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pyformat.diff
Url: http://mail.python.org/pipermail/python-dev/attachments/20060922/588484ab/attachment-0001.diff 


More information about the Python-Dev mailing list