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/xxsubtype.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-git-1a21451b1d73b65af949193208372e86bf308411.tar.gz |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/xxsubtype.c')
-rw-r--r-- | Modules/xxsubtype.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c index 6eb77d2bf5..7f33c835bb 100644 --- a/Modules/xxsubtype.c +++ b/Modules/xxsubtype.c @@ -257,8 +257,21 @@ static PyMethodDef xxsubtype_functions[] = { {NULL, NULL} /* sentinel */ }; +static struct PyModuleDef xxsubtypemodule = { + PyModuleDef_HEAD_INIT, + "xxsubtype", + xxsubtype__doc__, + -1, + xxsubtype_functions, + NULL, + NULL, + NULL, + NULL +}; + + PyMODINIT_FUNC -initxxsubtype(void) +PyInit_xxsubtype(void) { PyObject *m; @@ -268,30 +281,29 @@ initxxsubtype(void) so it's not necessary to fill in ob_type first. */ spamdict_type.tp_base = &PyDict_Type; if (PyType_Ready(&spamdict_type) < 0) - return; + return NULL; spamlist_type.tp_base = &PyList_Type; if (PyType_Ready(&spamlist_type) < 0) - return; + return NULL; - m = Py_InitModule3("xxsubtype", - xxsubtype_functions, - xxsubtype__doc__); + m = PyModule_Create(&xxsubtypemodule); if (m == NULL) - return; + return NULL; if (PyType_Ready(&spamlist_type) < 0) - return; + return NULL; if (PyType_Ready(&spamdict_type) < 0) - return; + return NULL; Py_INCREF(&spamlist_type); if (PyModule_AddObject(m, "spamlist", (PyObject *) &spamlist_type) < 0) - return; + return NULL; Py_INCREF(&spamdict_type); if (PyModule_AddObject(m, "spamdict", (PyObject *) &spamdict_type) < 0) - return; + return NULL; + return m; } |