Remove many uses of PyArg_NoArgs macro, change METH_OLDARGS to METH_NOARGS.

This commit is contained in:
Neal Norwitz 2002-03-25 20:46:46 +00:00
parent 57f8e06e4f
commit 3a6f97850b
9 changed files with 65 additions and 122 deletions

View file

@ -87,11 +87,8 @@ and the return value reflects whether the lock is acquired.\n\
The blocking operation is not interruptible.";
static PyObject *
lock_PyThread_release_lock(lockobject *self, PyObject *args)
lock_PyThread_release_lock(lockobject *self)
{
if (!PyArg_NoArgs(args))
return NULL;
/* Sanity check: the lock must be locked */
if (PyThread_acquire_lock(self->lock_lock, 0)) {
PyThread_release_lock(self->lock_lock);
@ -113,11 +110,8 @@ the lock to acquire the lock. The lock must be in the locked state,\n\
but it needn't be locked by the same thread that unlocks it.";
static PyObject *
lock_locked_lock(lockobject *self, PyObject *args)
lock_locked_lock(lockobject *self)
{
if (!PyArg_NoArgs(args))
return NULL;
if (PyThread_acquire_lock(self->lock_lock, 0)) {
PyThread_release_lock(self->lock_lock);
return PyInt_FromLong(0L);
@ -137,11 +131,11 @@ static PyMethodDef lock_methods[] = {
{"acquire", (PyCFunction)lock_PyThread_acquire_lock,
METH_OLDARGS, acquire_doc},
{"release_lock", (PyCFunction)lock_PyThread_release_lock,
METH_OLDARGS, release_doc},
METH_NOARGS, release_doc},
{"release", (PyCFunction)lock_PyThread_release_lock,
METH_OLDARGS, release_doc},
{"locked_lock", (PyCFunction)lock_locked_lock,
METH_OLDARGS, locked_doc},
METH_NOARGS, locked_doc},
{"locked", (PyCFunction)lock_locked_lock,
METH_OLDARGS, locked_doc},
{NULL, NULL} /* sentinel */
@ -267,10 +261,8 @@ when the function raises an unhandled exception; a stack trace will be\n\
printed unless the exception is SystemExit.\n";
static PyObject *
thread_PyThread_exit_thread(PyObject *self, PyObject *args)
thread_PyThread_exit_thread(PyObject *self)
{
if (!PyArg_NoArgs(args))
return NULL;
PyErr_SetNone(PyExc_SystemExit);
return NULL;
}
@ -295,10 +287,8 @@ thread_PyThread_exit_prog(PyObject *self, PyObject *args)
#endif
static PyObject *
thread_PyThread_allocate_lock(PyObject *self, PyObject *args)
thread_PyThread_allocate_lock(PyObject *self)
{
if (!PyArg_NoArgs(args))
return NULL;
return (PyObject *) newlockobject();
}
@ -309,11 +299,9 @@ static char allocate_doc[] =
Create a new lock object. See LockType.__doc__ for information about locks.";
static PyObject *
thread_get_ident(PyObject *self, PyObject *args)
thread_get_ident(PyObject *self)
{
long ident;
if (!PyArg_NoArgs(args))
return NULL;
ident = PyThread_get_thread_ident();
if (ident == -1) {
PyErr_SetString(ThreadError, "no current thread ident");
@ -341,15 +329,15 @@ static PyMethodDef thread_methods[] = {
METH_VARARGS,
start_new_doc},
{"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock,
METH_OLDARGS, allocate_doc},
METH_NOARGS, allocate_doc},
{"allocate", (PyCFunction)thread_PyThread_allocate_lock,
METH_OLDARGS, allocate_doc},
{"exit_thread", (PyCFunction)thread_PyThread_exit_thread,
METH_OLDARGS, exit_doc},
METH_NOARGS, exit_doc},
{"exit", (PyCFunction)thread_PyThread_exit_thread,
METH_OLDARGS, exit_doc},
{"get_ident", (PyCFunction)thread_get_ident,
METH_OLDARGS, get_ident_doc},
METH_NOARGS, get_ident_doc},
#ifndef NO_EXIT_PROG
{"exit_prog", (PyCFunction)thread_PyThread_exit_prog},
#endif