summaryrefslogtreecommitdiffstats
path: root/Modules/_gdbmmodule.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/_gdbmmodule.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/_gdbmmodule.c')
-rw-r--r--Modules/_gdbmmodule.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c
index abc8837..b253e20 100644
--- a/Modules/_gdbmmodule.c
+++ b/Modules/_gdbmmodule.c
@@ -511,17 +511,28 @@ static PyMethodDef dbmmodule_methods[] = {
{ 0, 0 },
};
+
+static struct PyModuleDef _gdbmmodule = {
+ PyModuleDef_HEAD_INIT,
+ "_gdbm",
+ gdbmmodule__doc__,
+ -1,
+ dbmmodule_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_gdbm(void) {
+PyInit__gdbm(void) {
PyObject *m, *d, *s;
if (PyType_Ready(&Dbmtype) < 0)
- return;
- m = Py_InitModule4("_gdbm", dbmmodule_methods,
- gdbmmodule__doc__, (PyObject *)NULL,
- PYTHON_API_VERSION);
+ return NULL;
+ m = PyModule_Create(&_gdbmmodule);
if (m == NULL)
- return;
+ return NULL;
d = PyModule_GetDict(m);
DbmError = PyErr_NewException("_gdbm.error", PyExc_IOError, NULL);
if (DbmError != NULL) {
@@ -530,4 +541,5 @@ init_gdbm(void) {
PyDict_SetItemString(d, "open_flags", s);
Py_DECREF(s);
}
+ return m;
}