Bugs item #1209880, was opened at 2005-05-27 10:04 Message generated for change (Comment added) made by akuchling You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1209880&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Chris Perkins (cperkins) >Assigned to: A.M. Kuchling (akuchling) Summary: doc bug in Lock.acquire Initial Comment: The docs for the acquire method in both the thread and threading modules are incorrect. They describe an old (insane) version that returned None when called with no argument. It appears that acquire is now sane, and always returns True or False. ---------------------------------------------------------------------- >Comment By: A.M. Kuchling (akuchling) Date: 2005-06-02 13:01 Message: Logged In: YES user_id=11375 I've changed the docs on both the HEAD and 2.4-maint branches to only describe the True/False return values. Thanks for your report! ---------------------------------------------------------------------- Comment By: A.M. Kuchling (akuchling) Date: 2005-06-02 08:37 Message: Logged In: YES user_id=11375 I think the (args==NULL) code path is vestigial and can no longer be executed, because the PyArg_ParseTuple call will fail if args is NULL. ---------------------------------------------------------------------- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-05-31 05:33 Message: Logged In: YES user_id=1188172 It certainly seems that there is a code path in Lock.acquire that can return None, as the following excerpt from Modules/threadmodule.c shows: static PyObject * lock_PyThread_acquire_lock(lockobject *self, PyObject *args) { int i = 1; if (!PyArg_ParseTuple(args, "|i:acquire", &i)) return NULL; Py_BEGIN_ALLOW_THREADS i = PyThread_acquire_lock(self->lock_lock, i); Py_END_ALLOW_THREADS if (args == NULL) { Py_INCREF(Py_None); return Py_None; } else return PyBool_FromLong((long)i); } Nevertheless, a_lock.acquire() still returns true. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1209880&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com