summaryrefslogtreecommitdiff
path: root/Modules/sha512module.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 +0000
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 +0000
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/sha512module.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-git-1a21451b1d73b65af949193208372e86bf308411.tar.gz
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/sha512module.c')
-rw-r--r--Modules/sha512module.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index 3fe5a1b2fc..472b158080 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -748,20 +748,29 @@ static struct PyMethodDef SHA_functions[] = {
#define insint(n,v) { PyModule_AddIntConstant(m,n,v); }
+
+static struct PyModuleDef _sha512module = {
+ PyModuleDef_HEAD_INIT,
+ "_sha512",
+ NULL,
+ -1,
+ SHA_functions,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_sha512(void)
+PyInit__sha512(void)
{
- PyObject *m;
-
Py_TYPE(&SHA384type) = &PyType_Type;
if (PyType_Ready(&SHA384type) < 0)
- return;
+ return NULL;
Py_TYPE(&SHA512type) = &PyType_Type;
if (PyType_Ready(&SHA512type) < 0)
- return;
- m = Py_InitModule("_sha512", SHA_functions);
- if (m == NULL)
- return;
+ return NULL;
+ return PyModule_Create(&_sha512module);
}
#endif