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/sha256module.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/sha256module.c')
-rw-r--r-- | Modules/sha256module.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Modules/sha256module.c b/Modules/sha256module.c index 162a905..9cecd3a 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -682,18 +682,27 @@ static struct PyMethodDef SHA_functions[] = { #define insint(n,v) { PyModule_AddIntConstant(m,n,v); } + +static struct PyModuleDef _sha256module = { + PyModuleDef_HEAD_INIT, + "_sha256", + NULL, + -1, + SHA_functions, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_sha256(void) +PyInit__sha256(void) { - PyObject *m; - Py_TYPE(&SHA224type) = &PyType_Type; if (PyType_Ready(&SHA224type) < 0) - return; + return NULL; Py_TYPE(&SHA256type) = &PyType_Type; if (PyType_Ready(&SHA256type) < 0) - return; - m = Py_InitModule("_sha256", SHA_functions); - if (m == NULL) - return; + return NULL; + return PyModule_Create(&_sha256module); } |