aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Doc/extending/embedding.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/extending/embedding.rst')
-rw-r--r--Doc/extending/embedding.rst12
1 files changed, 7 insertions, 5 deletions
diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst
index b777862da79..cb41889437c 100644
--- a/Doc/extending/embedding.rst
+++ b/Doc/extending/embedding.rst
@@ -245,21 +245,23 @@ Python extension. For example::
return PyLong_FromLong(numargs);
}
- static PyMethodDef EmbMethods[] = {
+ static PyMethodDef emb_module_methods[] = {
{"numargs", emb_numargs, METH_VARARGS,
"Return the number of arguments received by the process."},
{NULL, NULL, 0, NULL}
};
- static PyModuleDef EmbModule = {
- PyModuleDef_HEAD_INIT, "emb", NULL, -1, EmbMethods,
- NULL, NULL, NULL, NULL
+ static struct PyModuleDef emb_module = {
+ .m_base = PyModuleDef_HEAD_INIT,
+ .m_name = "emb",
+ .m_size = 0,
+ .m_methods = emb_module_methods,
};
static PyObject*
PyInit_emb(void)
{
- return PyModule_Create(&EmbModule);
+ return PyModuleDef_Init(&emb_module);
}
Insert the above code just above the :c:func:`main` function. Also, insert the