[Python-Dev] Vestigial code in threadmodule?

A.M. Kuchling amk at amk.ca
Thu Jun 2 14:52:05 CEST 2005

Looking at bug #1209880, the following function from threadmodule.c is
referenced.  I think the args==NULL case, which can return None
instead of a Boolean value, can never be reached because
PyArg_ParseTuple() will fail if args==NULL.

Before ripping the args==NULL code out, I wanted to be sure my
analysis is correct; is there some subtlety here I'm missing that
makes args==NULL possible?


static PyObject *
lock_PyThread_acquire_lock(lockobject *self, PyObject *args)
   int i = 1;

   if (!PyArg_ParseTuple(args, "|i:acquire", &i))
      return NULL;

   i = PyThread_acquire_lock(self->lock_lock, i);

   if (args == NULL) {
      return Py_None;
      return PyBool_FromLong((long)i);

More information about the Python-Dev mailing list