summaryrefslogtreecommitdiffstats
path: root/PC/_msi.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 /PC/_msi.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 'PC/_msi.c')
-rw-r--r--PC/_msi.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index 6c6f2f8..ec6c203 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -997,14 +997,27 @@ static PyMethodDef msi_methods[] = {
static char msi_doc[] = "Documentation";
+
+static struct PyModuleDef _msimodule = {
+ PyModuleDef_HEAD_INIT,
+ "_msi",
+ msi_doc,
+ -1,
+ msi_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_msi(void)
+PyInit__msi(void)
{
PyObject *m;
- m = Py_InitModule3("_msi", msi_methods, msi_doc);
+ m = PyModule_Create(&_msimodule);
if (m == NULL)
- return;
+ return NULL;
PyModule_AddIntConstant(m, "MSIDBOPEN_CREATEDIRECT", (int)MSIDBOPEN_CREATEDIRECT);
PyModule_AddIntConstant(m, "MSIDBOPEN_CREATE", (int)MSIDBOPEN_CREATE);
@@ -1050,6 +1063,7 @@ init_msi(void)
MSIError = PyErr_NewException ("_msi.MSIError", NULL, NULL);
if (!MSIError)
- return;
+ return NULL;
PyModule_AddObject(m, "MSIError", MSIError);
+ return NULL;
}