Staging
v0.8.1
https://github.com/python/cpython
Revision 278519500f6c551cc2a8035f11a81d21fae7424c authored by Benjamin Peterson on 10 November 2013, 07:36:30 UTC, committed by Benjamin Peterson on 10 November 2013, 07:36:30 UTC
1 parent 1185273
Raw File
Tip revision: 278519500f6c551cc2a8035f11a81d21fae7424c authored by Benjamin Peterson on 10 November 2013, 07:36:30 UTC
2.7.6 final
Tip revision: 2785195
example.c
#include "Python.h"

static PyObject *
ex_foo(PyObject *self, PyObject *args)
{
	printf("Hello, world\n");
	Py_INCREF(Py_None);
	return Py_None;
}

static PyMethodDef example_methods[] = {
	{"foo", ex_foo, METH_VARARGS, "foo() doc string"},
	{NULL, NULL}
};

PyMODINIT_FUNC
initexample(void)
{
	Py_InitModule("example", example_methods);
}
back to top