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/_testcapimodule.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/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 20 |
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; } |