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/itertoolsmodule.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/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index fb61302..3a095b6 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -3030,8 +3030,21 @@ static PyMethodDef module_methods[] = { {NULL, NULL} /* sentinel */ }; + +static struct PyModuleDef itertoolsmodule = { + PyModuleDef_HEAD_INIT, + "itertools", + module_doc, + -1, + module_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -inititertools(void) +PyInit_itertools(void) { int i; PyObject *m; @@ -3055,13 +3068,13 @@ inititertools(void) }; Py_TYPE(&teedataobject_type) = &PyType_Type; - m = Py_InitModule3("itertools", module_methods, module_doc); + m = PyModule_Create(&itertoolsmodule); if (m == NULL) - return; + return NULL; for (i=0 ; typelist[i] != NULL ; i++) { if (PyType_Ready(typelist[i]) < 0) - return; + return NULL; name = strchr(typelist[i]->tp_name, '.'); assert (name != NULL); Py_INCREF(typelist[i]); @@ -3069,9 +3082,10 @@ inititertools(void) } if (PyType_Ready(&teedataobject_type) < 0) - return; + return NULL; if (PyType_Ready(&tee_type) < 0) - return; + return NULL; if (PyType_Ready(&_grouper_type) < 0) - return; + return NULL; + return m; } |