Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changes requested by review
  • Loading branch information
koubaa committed Jul 2, 2020
commit 598fd1ad73b4b4259bebd7164760b3bbeaf1d86b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port :mod:`sha256` to multiphase initialization
26 changes: 16 additions & 10 deletions Modules/sha256module.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,15 @@ static int sha256_exec(PyObject *module)
}

Py_INCREF((PyObject *)&SHA224type);
PyModule_AddObject(module, "SHA224Type", (PyObject *)&SHA224type);
if (PyModule_AddObject(module, "SHA224Type", (PyObject *)&SHA224type) < 0) {
Py_DECREF(PyObject *)&SHA224type);
return -1;
}
Py_INCREF((PyObject *)&SHA256type);
PyModule_AddObject(module, "SHA256Type", (PyObject *)&SHA256type);
if (PyModule_AddObject(module, "SHA256Type", (PyObject *)&SHA256type) < 0) {
Py_DECREF(PyObject *)&SHA256type);
return -1;
}
return 0;
}

Expand All @@ -706,14 +712,14 @@ static PyModuleDef_Slot _sha256_slots[] = {

static struct PyModuleDef _sha256module = {
Comment thread
koubaa marked this conversation as resolved.
PyModuleDef_HEAD_INIT,
"_sha256",
NULL,
0,
SHA_functions,
_sha256_slots,
NULL,
NULL,
NULL
.m_name = "_sha256",
.m_doc = NULL,
.m_size = 0,
.m_methods = SHA_functions,
.m_slots = _sha256_slots,
.m_traverse = NULL,
.m_clear = NULL,
.m_free = NULL
Comment thread
koubaa marked this conversation as resolved.
Outdated
};

/* Initialize this module. */
Expand Down