[issue2443] uninitialized access to va_list

Alexander Belopolsky report at bugs.python.org
Tue Mar 25 15:31:00 CET 2008

Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

This is not a bug.  All the reported functions expect va_list argument 
to be initialized before being called.  AFAICT, they are consistently 
used in this way.  For example,

PyObject *
PyObject_CallFunctionObjArgs(PyObject *callable, ...)
        PyObject *args, *tmp;
        va_list vargs;

        if (callable == NULL)
                return null_error();

        /* count the args */
        va_start(vargs, callable);
        args = objargs_mktuple(vargs);
        if (args == NULL)
                return NULL;
        tmp = PyObject_Call(callable, args, NULL);

        return tmp;

This may need to be clarified in the docs.  For example, PyString_FromFormatV does not mention that vargs needs to be 
initialized: <http://docs.python.org/dev/c-
api/string.html#PyString_FromFormatV>.  On the other hand, this may be 
obvious to most C programmers.

I suggest to close this issue as invalid.

nosy: +belopolsky

Tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list