[Python-3000] Invalid type for 'u' argument 3

"Martin v. Löwis" martin at v.loewis.de
Wed Aug 29 19:24:16 CEST 2007


> On some buildbots I see this failure to build the datetime module:

See also bugs.python.org/1055.

> error: Invalid type for 'u' argument 3
> 
> The source line is this:
> 
> 	if (!PyArg_ParseTuple(args, "uu:strptime", &string, &format))

and string and format are of type char*; for "u", they should be of
type Py_UNICODE*.

> I hink this is relevant, in pyport.h:
> 
> #ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE
> #define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2)))
> #else
> #define Py_FORMAT_PARSETUPLE(func,p1,p2)
> #endif
> 
> But how does this work?

Also consider this:

PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...)
Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);

Together, they expand to

int PyArg_ParseTuple(PyObject*, const char*, ...)
__attribute__((format(PyArg_ParseTuple, 2, 3)));

It's exactly one buildbot slave (I hope), the one that runs mvlgcc. I
created a patch for GCC to check ParseTuple calls for correctness, and
set up a buildbot slave to use this compiler.

Regards,
Martin



More information about the Python-3000 mailing list