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