aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 +0000
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 +0000
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/pwdmodule.c
parentblock 64105 (diff)
downloadcpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2
cpython-1a21451b1d73b65af949193208372e86bf308411.zip
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/pwdmodule.c')
-rw-r--r--Modules/pwdmodule.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index 9511736ccb2..cb99183f27c 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -182,13 +182,26 @@ static PyMethodDef pwd_methods[] = {
{NULL, NULL} /* sentinel */
};
+static struct PyModuleDef pwdmodule = {
+ PyModuleDef_HEAD_INIT,
+ "pwd",
+ pwd__doc__,
+ -1,
+ pwd_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+
PyMODINIT_FUNC
-initpwd(void)
+PyInit_pwd(void)
{
PyObject *m;
- m = Py_InitModule3("pwd", pwd_methods, pwd__doc__);
+ m = PyModule_Create(&pwdmodule);
if (m == NULL)
- return;
+ return NULL;
if (!initialized)
PyStructSequence_InitType(&StructPwdType,
@@ -198,4 +211,5 @@ initpwd(void)
/* And for b/w compatibility (this was defined by mistake): */
PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType);
initialized = 1;
+ return m;
}