summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/_testcapimodule.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-1a21451b1d73b65af949193208372e86bf308411.zip
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 7c28538..3dd2cdb 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1135,14 +1135,27 @@ static PyTypeObject test_structmembersType = {
};
+
+static struct PyModuleDef _testcapimodule = {
+ PyModuleDef_HEAD_INIT,
+ "_testcapi",
+ NULL,
+ -1,
+ TestMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_testcapi(void)
+PyInit__testcapi(void)
{
PyObject *m;
- m = Py_InitModule("_testcapi", TestMethods);
+ m = PyModule_Create(&_testcapimodule);
if (m == NULL)
- return;
+ return NULL;
Py_TYPE(&test_structmembersType)=&PyType_Type;
Py_INCREF(&test_structmembersType);
@@ -1173,4 +1186,5 @@ init_testcapi(void)
TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
Py_INCREF(TestError);
PyModule_AddObject(m, "error", TestError);
+ return m;
}