X Tutup
Skip to content

Commit 05b482c

Browse files
committed
python#4586: fix usage of Py_InitModule.
1 parent d153afe commit 05b482c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Doc/extending/embedding.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,16 @@ Python extension. For example::
218218
{NULL, NULL, 0, NULL}
219219
};
220220

221+
static PyModuleDef EmbModule = {
222+
PyModuleDef_HEAD_INIT, "emb", NULL, -1, EmbMethods,
223+
NULL, NULL, NULL, NULL
224+
};
225+
221226
Insert the above code just above the :cfunc:`main` function. Also, insert the
222227
following two statements directly after :cfunc:`Py_Initialize`::
223228

224229
numargs = argc;
225-
Py_InitModule("emb", EmbMethods);
230+
PyModule_Create(&EmbModule);
226231

227232
These two lines initialize the ``numargs`` variable, and make the
228233
:func:`emb.numargs` function accessible to the embedded Python interpreter.

0 commit comments

Comments
 (0)
X Tutup