summaryrefslogtreecommitdiffstats
path: root/Modules/fpectlmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/fpectlmodule.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-1a21451b1d73b65af949193208372e86bf308411.zip
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/fpectlmodule.c')
-rw-r--r--Modules/fpectlmodule.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c
index 74354ba..d3518f5 100644
--- a/Modules/fpectlmodule.c
+++ b/Modules/fpectlmodule.c
@@ -90,7 +90,8 @@ static Sigfunc sigfpe_handler;
static void fpe_reset(Sigfunc *);
static PyObject *fpe_error;
-PyMODINIT_FUNC initfpectl(void);
+
+PyMODINIT_FUNC PyInit_fpectl(void);
static PyObject *turnon_sigfpe (PyObject *self,PyObject *args);
static PyObject *turnoff_sigfpe (PyObject *self,PyObject *args);
@@ -286,16 +287,29 @@ static void sigfpe_handler(int signo)
}
}
-PyMODINIT_FUNC initfpectl(void)
+static struct PyModuleDef fpectlmodule = {
+ PyModuleDef_HEAD_INIT,
+ "fpectl",
+ NULL,
+ -1,
+ fpectl_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC PyInit_fpectl(void)
{
PyObject *m, *d;
- m = Py_InitModule("fpectl", fpectl_methods);
+ m = PyModule_Create("fpectl", fpectl_methods);
if (m == NULL)
- return;
+ return NULL;
d = PyModule_GetDict(m);
fpe_error = PyErr_NewException("fpectl.error", NULL, NULL);
if (fpe_error != NULL)
PyDict_SetItemString(d, "error", fpe_error);
+ return m;
}
#ifdef __cplusplus