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/md5module.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/md5module.c')
-rw-r--r-- | Modules/md5module.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/Modules/md5module.c b/Modules/md5module.c index 6a18a13..c6610a6 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -547,15 +547,24 @@ static struct PyMethodDef MD5_functions[] = { #define insint(n,v) { PyModule_AddIntConstant(m,n,v); } + +static struct PyModuleDef _md5module = { + PyModuleDef_HEAD_INIT, + "_md5", + NULL, + -1, + MD5_functions, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_md5(void) +PyInit__md5(void) { - PyObject *m; - Py_TYPE(&MD5type) = &PyType_Type; if (PyType_Ready(&MD5type) < 0) - return; - m = Py_InitModule("_md5", MD5_functions); - if (m == NULL) - return; + return NULL; + return PyModule_Create("_md5", MD5_functions); } |