Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 8cee0cc3fea74f9abcb0ce343a86fa4c71673ead authored by Ned Deily on 06 September 2017, 07:23:33 UTC
Bump to 3.3.7rc1
Tip revision: 8cee0cc
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