[Python-Dev] threadmodule.c comment error? (from comp.lang.python)
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Fri, 1 Sep 2000 00:47:03 +0200
as noted by curtis jensen over at comp.lang.python:
the parse tuple string doesn't quite match the error message
given if the 2nd argument isn't a tuple. on the other hand, the
args argument is initialized to NULL...
thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
{
PyObject *func, *args = NULL, *keyw = NULL;
struct bootstate *boot;
if (!PyArg_ParseTuple(fargs, "OO|O:start_new_thread", &func, &args, &keyw))
return NULL;
if (!PyCallable_Check(func)) {
PyErr_SetString(PyExc_TypeError,
"first arg must be callable");
return NULL;
}
if (!PyTuple_Check(args)) {
PyErr_SetString(PyExc_TypeError,
"optional 2nd arg must be a tuple");
return NULL;
}
if (keyw != NULL && !PyDict_Check(keyw)) {
PyErr_SetString(PyExc_TypeError,
"optional 3rd arg must be a dictionary");
return NULL;
}
what's the right way to fix this? (change the error message
and remove the initialization, or change the parsetuple string
and the tuple check)
</F>