diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-03-31 15:27:00 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-03-31 15:27:00 (GMT) |
commit | ba3a16c6c3d3da0903873e9464dbc540eaeda1f7 (patch) | |
tree | 6094d419dcf56dfdb9bdb50da0a15d0c0160573a /Modules/threadmodule.c | |
parent | 50905b557b2a46d4db432b7a9e61fe32afa557e3 (diff) | |
download | cpython-ba3a16c6c3d3da0903873e9464dbc540eaeda1f7.zip cpython-ba3a16c6c3d3da0903873e9464dbc540eaeda1f7.tar.gz cpython-ba3a16c6c3d3da0903873e9464dbc540eaeda1f7.tar.bz2 |
Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Please review. All tests pass, but some modules don't have tests.
I spot checked various functions to try to make sure nothing broke.
Diffstat (limited to 'Modules/threadmodule.c')
-rw-r--r-- | Modules/threadmodule.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index 21313b5..2459c3b 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -54,14 +54,10 @@ lock_dealloc(lockobject *self) static PyObject * lock_PyThread_acquire_lock(lockobject *self, PyObject *args) { - int i; + int i = 1; - if (args != NULL) { - if (!PyArg_Parse(args, "i", &i)) - return NULL; - } - else - i = 1; + if (!PyArg_ParseTuple(args, "|i:acquire", &i)) + return NULL; Py_BEGIN_ALLOW_THREADS i = PyThread_acquire_lock(self->lock_lock, i); @@ -127,9 +123,9 @@ Return whether the lock is in the locked state."; static PyMethodDef lock_methods[] = { {"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, - METH_OLDARGS, acquire_doc}, + METH_VARARGS, acquire_doc}, {"acquire", (PyCFunction)lock_PyThread_acquire_lock, - METH_OLDARGS, acquire_doc}, + METH_VARARGS, acquire_doc}, {"release_lock", (PyCFunction)lock_PyThread_release_lock, METH_NOARGS, release_doc}, {"release", (PyCFunction)lock_PyThread_release_lock, @@ -279,7 +275,7 @@ static PyObject * thread_PyThread_exit_prog(PyObject *self, PyObject *args) { int sts; - if (!PyArg_Parse(args, "i", &sts)) + if (!PyArg_ParseTuple(args, "i:exit_prog", &sts)) return NULL; Py_Exit(sts); /* Calls PyThread_exit_prog(sts) or _PyThread_exit_prog(sts) */ for (;;) { } /* Should not be reached */ @@ -339,7 +335,8 @@ static PyMethodDef thread_methods[] = { {"get_ident", (PyCFunction)thread_get_ident, METH_NOARGS, get_ident_doc}, #ifndef NO_EXIT_PROG - {"exit_prog", (PyCFunction)thread_PyThread_exit_prog}, + {"exit_prog", (PyCFunction)thread_PyThread_exit_prog, + METH_VARARGS}, #endif {NULL, NULL} /* sentinel */ }; |