Staging
v0.5.1
https://github.com/python/cpython
Revision 1b94ab79a95ba69e017348ffeb04ef52616a4540 authored by Georg Brandl on 11 August 2012, 06:49:20 UTC, committed by Georg Brandl on 11 August 2012, 06:49:20 UTC
1 parent a81b481
Raw File
Tip revision: 1b94ab79a95ba69e017348ffeb04ef52616a4540 authored by Georg Brandl on 11 August 2012, 06:49:20 UTC
Bump to 3.3b2.
Tip revision: 1b94ab7
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}
};

static struct PyModuleDef examplemodule = {
    PyModuleDef_HEAD_INIT,
    "example",
    "example module doc string",
    -1,
    example_methods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC
PyInit_example(void)
{
    return PyModule_Create(&examplemodule);
}
back to top