diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/fpetestmodule.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-1a21451b1d73b65af949193208372e86bf308411.zip cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2 |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/fpetestmodule.c')
-rw-r--r-- | Modules/fpetestmodule.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Modules/fpetestmodule.c b/Modules/fpetestmodule.c index 22e95db..64acd3d 100644 --- a/Modules/fpetestmodule.c +++ b/Modules/fpetestmodule.c @@ -44,7 +44,8 @@ #include "Python.h" static PyObject *fpe_error; -PyMODINIT_FUNC initfpetest(void); + +PyMODINIT_FUNC PyInit_fpetest(void); static PyObject *test(PyObject *self,PyObject *args); static double db0(double); static double overflow(double); @@ -172,15 +173,28 @@ static double overflow(double b) return a; } -PyMODINIT_FUNC initfpetest(void) +static struct PyModuleDef fpetestmodule = { + PyModuleDef_HEAD_INIT, + "fpetest", + NULL, + -1, + fpetest_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC PyInit_fpetest(void) { PyObject *m, *d; - m = Py_InitModule("fpetest", fpetest_methods); + m = PyModule_Create(&fpetestmodule); if (m == NULL) - return; + return NULL; d = PyModule_GetDict(m); fpe_error = PyErr_NewException("fpetest.error", NULL, NULL); if (fpe_error != NULL) PyDict_SetItemString(d, "error", fpe_error); + return m; } |