[Python-checkins] r67655 - python/branches/py3k/Doc/extending/embedding.rst
georg.brandl
python-checkins at python.org
Sun Dec 7 23:45:56 CET 2008
Author: georg.brandl
Date: Sun Dec 7 23:45:56 2008
New Revision: 67655
Log:
#4586: fix usage of Py_InitModule.
Modified:
python/branches/py3k/Doc/extending/embedding.rst
Modified: python/branches/py3k/Doc/extending/embedding.rst
==============================================================================
--- python/branches/py3k/Doc/extending/embedding.rst (original)
+++ python/branches/py3k/Doc/extending/embedding.rst Sun Dec 7 23:45:56 2008
@@ -218,11 +218,16 @@
{NULL, NULL, 0, NULL}
};
+ static PyModuleDef EmbModule = {
+ PyModuleDef_HEAD_INIT, "emb", NULL, -1, EmbMethods,
+ NULL, NULL, NULL, NULL
+ };
+
Insert the above code just above the :cfunc:`main` function. Also, insert the
following two statements directly after :cfunc:`Py_Initialize`::
numargs = argc;
- Py_InitModule("emb", EmbMethods);
+ PyModule_Create(&EmbModule);
These two lines initialize the ``numargs`` variable, and make the
:func:`emb.numargs` function accessible to the embedded Python interpreter.
More information about the Python-checkins
mailing list