diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 +0000 |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/cmathmodule.c | |
parent | block 64105 (diff) | |
download | cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2 cpython-1a21451b1d73b65af949193208372e86bf308411.zip |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/cmathmodule.c')
-rw-r--r-- | Modules/cmathmodule.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index 109f2cc9f9f..eec618ecfc3 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -1077,14 +1077,27 @@ static PyMethodDef cmath_methods[] = { {NULL, NULL} /* sentinel */ }; + +static struct PyModuleDef cmathmodule = { + PyModuleDef_HEAD_INIT, + "cmath", + module_doc, + -1, + cmath_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initcmath(void) +PyInit_cmath(void) { PyObject *m; - m = Py_InitModule3("cmath", cmath_methods, module_doc); + m = PyModule_Create(&cmathmodule); if (m == NULL) - return; + return NULL; PyModule_AddObject(m, "pi", PyFloat_FromDouble(Py_MATH_PI)); @@ -1204,4 +1217,5 @@ initcmath(void) C(INF,N) C(U,U) C(INF,-0.) C(INF,0.) C(U,U) C(INF,N) C(INF,N) C(N,N) C(N,N) C(N,0.) C(N,0.) C(N,N) C(N,N) C(N,N) }) + return m; } |