mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Update to use more modern calling conventions; also avoid a magic number
in the function table. Add a docstring for the function as well, since examples should show good form.
This commit is contained in:
parent
e012e35460
commit
3176b08874
1 changed files with 2 additions and 3 deletions
|
|
@ -48,13 +48,12 @@ main(int argc, char **argv)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
xyzzy_foo(PyObject *self, PyObject* args)
|
xyzzy_foo(PyObject *self, PyObject* args)
|
||||||
{
|
{
|
||||||
if (!PyArg_ParseTuple(args, ""))
|
|
||||||
return NULL;
|
|
||||||
return PyInt_FromLong(42L);
|
return PyInt_FromLong(42L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef xyzzy_methods[] = {
|
static PyMethodDef xyzzy_methods[] = {
|
||||||
{"foo", xyzzy_foo, 1},
|
{"foo", xyzzy_foo, METH_NOARGS,
|
||||||
|
"Return the meaning of everything."},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue