]> granicus.if.org Git - python/commitdiff
#4586: fix usage of Py_InitModule.
authorGeorg Brandl <georg@python.org>
Sun, 7 Dec 2008 22:45:56 +0000 (22:45 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 7 Dec 2008 22:45:56 +0000 (22:45 +0000)
Doc/extending/embedding.rst

index c86ae8ab2a31d827dba4a016b842b9bce34f7e3d..e5c7da19d9942092f89683940a37bd53b94bbace 100644 (file)
@@ -218,11 +218,16 @@ Python extension.  For example::
        {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.