diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 +0000 |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/spwdmodule.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-git-1a21451b1d73b65af949193208372e86bf308411.tar.gz |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/spwdmodule.c')
-rw-r--r-- | Modules/spwdmodule.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c index 08a3d1bd43..a6b9d93fed 100644 --- a/Modules/spwdmodule.c +++ b/Modules/spwdmodule.c @@ -167,17 +167,31 @@ static PyMethodDef spwd_methods[] = { }; + +static struct PyModuleDef spwdmodule = { + PyModuleDef_HEAD_INIT, + "spwd", + spwd__doc__, + -1, + spwd_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initspwd(void) +PyInit_spwd(void) { PyObject *m; - m=Py_InitModule3("spwd", spwd_methods, spwd__doc__); + m=PyModule_Create(&spwdmodule); if (m == NULL) - return; + return NULL; if (!initialized) PyStructSequence_InitType(&StructSpwdType, &struct_spwd_type_desc); Py_INCREF((PyObject *) &StructSpwdType); PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType); initialized = 1; + return m; } |