From 574b1279d974b45064492ec53e7dd0a81a4ef0e0 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 2 Jan 2009 19:20:26 +0000 Subject: [PATCH] Remove traces of Py_InitModule*. --- Objects/moduleobject.c | 4 ++-- PC/example_nt/example.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 7f81ce41bd..9c705b888d 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -91,9 +91,9 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version) This is a bit of a hack: when the shared library is loaded, the module name is "package.module", but the module calls - Py_InitModule*() with just "module" for the name. The shared + PyModule_Create*() with just "module" for the name. The shared library loader squirrels away the true name of the module in - _Py_PackageContext, and Py_InitModule*() will substitute this + _Py_PackageContext, and PyModule_Create*() will substitute this (if the name actually matches). */ if (_Py_PackageContext != NULL) { diff --git a/PC/example_nt/example.c b/PC/example_nt/example.c index 953fb824e7..d807311d96 100644 --- a/PC/example_nt/example.c +++ b/PC/example_nt/example.c @@ -13,8 +13,20 @@ static PyMethodDef example_methods[] = { {NULL, NULL} }; +static struct PyModuleDef examplemodule = { + PyModuleDef_HEAD_INIT, + "example", + "example module doc string", + -1, + example_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initexample(void) +PyInit_example(void) { - Py_InitModule("example", example_methods); + return PyModule_Create(&examplemodule); } -- 2.40.0