]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Update to use more modern calling conventions; also avoid a magic number
authorFred Drake <fdrake@acm.org>
Sat, 17 Nov 2001 06:30:20 +0000 (06:30 +0000)
committerFred Drake <fdrake@acm.org>
Sat, 17 Nov 2001 06:30:20 +0000 (06:30 +0000)
in the function table.  Add a docstring for the function as well, since
examples should show good form.

Demo/embed/demo.c

index 581365f36e20aa61370cfb3f686dde92625192e1..6005f1396bf1b3c963f3c65f8c950e0a39e23272 100644 (file)
@@ -48,13 +48,12 @@ main(int argc, char **argv)
 static PyObject *
 xyzzy_foo(PyObject *self, PyObject* args)
 {
-       if (!PyArg_ParseTuple(args, ""))
-               return NULL;
        return PyInt_FromLong(42L);
 }
 
 static PyMethodDef xyzzy_methods[] = {
-       {"foo",         xyzzy_foo,      1},
+       {"foo",         xyzzy_foo,      METH_NOARGS,
+        "Return the meaning of everything."},
        {NULL,          NULL}           /* sentinel */
 };