diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/nismodule.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-1a21451b1d73b65af949193208372e86bf308411.zip cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2 |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/nismodule.c')
-rw-r--r-- | Modules/nismodule.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Modules/nismodule.c b/Modules/nismodule.c index bf2d185..3af394d 100644 --- a/Modules/nismodule.c +++ b/Modules/nismodule.c @@ -430,15 +430,28 @@ static PyMethodDef nis_methods[] = { PyDoc_STRVAR(nis__doc__, "This module contains functions for accessing NIS maps.\n"); -void -initnis (void) +static struct PyModuleDef nismodule = { + PyModuleDef_HEAD_INIT, + "nis", + nis__doc__, + -1, + nis_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyObject* +PyInit_nis (void) { PyObject *m, *d; - m = Py_InitModule3("nis", nis_methods, nis__doc__); + m = PyModule_Create(&nismodule); if (m == NULL) - return; + return NULL; d = PyModule_GetDict(m); NisError = PyErr_NewException("nis.error", NULL, NULL); if (NisError != NULL) PyDict_SetItemString(d, "error", NisError); + return m; } |