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/grpmodule.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/grpmodule.c')
-rw-r--r-- | Modules/grpmodule.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index a39ca76..039f794 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -179,16 +179,30 @@ according to the password database. Check both databases to get\n\ complete membership information.)"); + +static struct PyModuleDef grpmodule = { + PyModuleDef_HEAD_INIT, + "grp", + grp__doc__, + -1, + grp_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initgrp(void) +PyInit_grp(void) { PyObject *m, *d; - m = Py_InitModule3("grp", grp_methods, grp__doc__); + m = PyModule_Create(&grpmodule); if (m == NULL) - return; + return NULL; d = PyModule_GetDict(m); if (!initialized) PyStructSequence_InitType(&StructGrpType, &struct_group_type_desc); PyDict_SetItemString(d, "struct_group", (PyObject *) &StructGrpType); initialized = 1; + return m; } |