summaryrefslogtreecommitdiffstats
path: root/Modules/sha1module.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/sha1module.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/sha1module.c')
-rw-r--r--Modules/sha1module.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index 1d5f070..8502264 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -523,15 +523,26 @@ static struct PyMethodDef SHA1_functions[] = {
#define insint(n,v) { PyModule_AddIntConstant(m,n,v); }
+
+static struct PyModuleDef _sha1module = {
+ PyModuleDef_HEAD_INIT,
+ "_sha1",
+ NULL,
+ -1,
+ SHA1_functions,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_sha1(void)
+PyInit__sha1(void)
{
PyObject *m;
Py_TYPE(&SHA1type) = &PyType_Type;
if (PyType_Ready(&SHA1type) < 0)
- return;
- m = Py_InitModule("_sha1", SHA1_functions);
- if (m == NULL)
- return;
+ return NULL;
+ return PyModule_Create(&_sha1module);
}