Kaydet (Commit) 2efa3698 authored tarafından Guido van Rossum's avatar Guido van Rossum

Use modern PyArg_ParseTuple style, with function names.

üst 6a973c71
...@@ -713,7 +713,7 @@ marshal_dump(self, args) ...@@ -713,7 +713,7 @@ marshal_dump(self, args)
WFILE wf; WFILE wf;
PyObject *x; PyObject *x;
PyObject *f; PyObject *f;
if (!PyArg_Parse(args, "(OO)", &x, &f)) if (!PyArg_ParseTuple(args, "OO:dump", &x, &f))
return NULL; return NULL;
if (!PyFile_Check(f)) { if (!PyFile_Check(f)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
...@@ -741,7 +741,7 @@ marshal_load(self, args) ...@@ -741,7 +741,7 @@ marshal_load(self, args)
RFILE rf; RFILE rf;
PyObject *f; PyObject *f;
PyObject *v; PyObject *v;
if (!PyArg_Parse(args, "O", &f)) if (!PyArg_ParseTuple(args, "O:load", &f))
return NULL; return NULL;
if (!PyFile_Check(f)) { if (!PyFile_Check(f)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
...@@ -766,7 +766,7 @@ marshal_dumps(self, args) ...@@ -766,7 +766,7 @@ marshal_dumps(self, args)
PyObject *args; PyObject *args;
{ {
PyObject *x; PyObject *x;
if (!PyArg_Parse(args, "O", &x)) if (!PyArg_ParseTuple(args, "O:dumps", &x))
return NULL; return NULL;
return PyMarshal_WriteObjectToString(x); return PyMarshal_WriteObjectToString(x);
} }
...@@ -780,7 +780,7 @@ marshal_loads(self, args) ...@@ -780,7 +780,7 @@ marshal_loads(self, args)
PyObject *v; PyObject *v;
char *s; char *s;
int n; int n;
if (!PyArg_Parse(args, "s#", &s, &n)) if (!PyArg_ParseTuple(args, "s#:loads", &s, &n))
return NULL; return NULL;
rf.fp = NULL; rf.fp = NULL;
rf.str = args; rf.str = args;
...@@ -796,10 +796,10 @@ marshal_loads(self, args) ...@@ -796,10 +796,10 @@ marshal_loads(self, args)
} }
static PyMethodDef marshal_methods[] = { static PyMethodDef marshal_methods[] = {
{"dump", marshal_dump}, {"dump", marshal_dump, 1},
{"load", marshal_load}, {"load", marshal_load, 1},
{"dumps", marshal_dumps}, {"dumps", marshal_dumps, 1},
{"loads", marshal_loads}, {"loads", marshal_loads, 1},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment