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/_hashopenssl.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/_hashopenssl.c')
-rw-r--r-- | Modules/_hashopenssl.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index ecbe01c..8965f43 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -498,8 +498,21 @@ static struct PyMethodDef EVP_functions[] = { /* Initialize this module. */ + +static struct PyModuleDef _hashlibmodule = { + PyModuleDef_HEAD_INIT, + "_hashlib", + NULL, + -1, + EVP_functions, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_hashlib(void) +PyInit__hashlib(void) { PyObject *m; @@ -512,11 +525,11 @@ init_hashlib(void) Py_TYPE(&EVPtype) = &PyType_Type; if (PyType_Ready(&EVPtype) < 0) - return; + return NULL; - m = Py_InitModule("_hashlib", EVP_functions); + m = PyModule_Create(&_hashlibmodule); if (m == NULL) - return; + return NULL; #if HASH_OBJ_CONSTRUCTOR Py_INCREF(&EVPtype); @@ -530,4 +543,5 @@ init_hashlib(void) INIT_CONSTRUCTOR_CONSTANTS(sha256); INIT_CONSTRUCTOR_CONSTANTS(sha384); INIT_CONSTRUCTOR_CONSTANTS(sha512); + return m; } |