summaryrefslogtreecommitdiffstats
path: root/Modules/dlmodule.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-03-31 15:43:28 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-03-31 15:43:28 (GMT)
commitb82d34f91eb2f43000cf7a8249aa74cc6b13d060 (patch)
tree1c3886ca9e236deca2327553c6351e50f0b64e3b /Modules/dlmodule.c
parentba3a16c6c3d3da0903873e9464dbc540eaeda1f7 (diff)
downloadcpython-b82d34f91eb2f43000cf7a8249aa74cc6b13d060.zip
cpython-b82d34f91eb2f43000cf7a8249aa74cc6b13d060.tar.gz
cpython-b82d34f91eb2f43000cf7a8249aa74cc6b13d060.tar.bz2
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
Please review for correctness.
Diffstat (limited to 'Modules/dlmodule.c')
-rw-r--r--Modules/dlmodule.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c
index d2364d4..4606ea8 100644
--- a/Modules/dlmodule.c
+++ b/Modules/dlmodule.c
@@ -39,10 +39,8 @@ dl_dealloc(dlobject *xp)
}
static PyObject *
-dl_close(dlobject *xp, PyObject *args)
+dl_close(dlobject *xp)
{
- if (!PyArg_Parse(args, ""))
- return NULL;
if (xp->dl_handle != NULL) {
dlclose(xp->dl_handle);
xp->dl_handle = NULL;
@@ -56,8 +54,13 @@ dl_sym(dlobject *xp, PyObject *args)
{
char *name;
PyUnivPtr *func;
- if (!PyArg_Parse(args, "s", &name))
+ if (PyString_Check(args)) {
+ name = PyString_AS_STRING(args);
+ } else {
+ PyErr_Format(PyExc_TypeError, "expected string, found %.200s",
+ args->ob_type->tp_name);
return NULL;
+ }
func = dlsym(xp->dl_handle, name);
if (func == NULL) {
Py_INCREF(Py_None);
@@ -121,8 +124,8 @@ dl_call(dlobject *xp, PyObject *args)
static PyMethodDef dlobject_methods[] = {
{"call", (PyCFunction)dl_call, METH_VARARGS},
- {"sym", (PyCFunction)dl_sym, METH_OLDARGS},
- {"close", (PyCFunction)dl_close, METH_OLDARGS},
+ {"sym", (PyCFunction)dl_sym, METH_O},
+ {"close", (PyCFunction)dl_close, METH_NOARGS},
{NULL, NULL} /* Sentinel */
};
@@ -165,11 +168,11 @@ dl_open(PyObject *self, PyObject *args)
return NULL;
}
- if (PyArg_Parse(args, "z", &name))
+ if (PyArg_ParseTuple(args, "z:open", &name))
mode = RTLD_LAZY;
else {
PyErr_Clear();
- if (!PyArg_Parse(args, "(zi)", &name, &mode))
+ if (!PyArg_ParseTuple(args, "zi:open", &name, &mode))
return NULL;
#ifndef RTLD_NOW
if (mode != RTLD_LAZY) {
@@ -187,7 +190,7 @@ dl_open(PyObject *self, PyObject *args)
}
static PyMethodDef dl_methods[] = {
- {"open", dl_open, METH_OLDARGS},
+ {"open", dl_open, METH_VARARGS},
{NULL, NULL} /* sentinel */
};