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

Guido van Rossum guido at python.org
Wed Aug 29 19:28:58 CEST 2007


Oh wow. I see, very clever and useful. It found a real bug! (Except it
was transparent since these variables were only used to pass to
another "uu" format, canceling out the type.) Fixed. Committed
revision 57665.

--Guido

On 8/29/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > 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
>
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list