From 1a21451b1d73b65af949193208372e86bf308411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 11 Jun 2008 05:26:20 +0000 Subject: Implement PEP 3121: new module initialization and finalization API. --- Modules/mathmodule.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'Modules/mathmodule.c') diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index f759adab5b..fa607e3f1e 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -1099,12 +1099,25 @@ PyDoc_STRVAR(module_doc, "This module is always available. It provides access to the\n" "mathematical functions defined by the C standard."); + +static struct PyModuleDef mathmodule = { + PyModuleDef_HEAD_INIT, + "math", + module_doc, + -1, + math_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initmath(void) +PyInit_math(void) { PyObject *m; - m = Py_InitModule3("math", math_methods, module_doc); + m = PyModule_Create(&mathmodule); if (m == NULL) goto finally; @@ -1112,5 +1125,5 @@ initmath(void) PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E)); finally: - return; + return m; } -- cgit v1.2.1