mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Issue #18742: Expose the internal hash type object for ABCs.
This commit is contained in:
parent
e53510726b
commit
327dd732ce
6 changed files with 55 additions and 8 deletions
|
|
@ -706,11 +706,23 @@ static struct PyModuleDef _sha256module = {
|
|||
PyMODINIT_FUNC
|
||||
PyInit__sha256(void)
|
||||
{
|
||||
PyObject *m;
|
||||
|
||||
Py_TYPE(&SHA224type) = &PyType_Type;
|
||||
if (PyType_Ready(&SHA224type) < 0)
|
||||
return NULL;
|
||||
Py_TYPE(&SHA256type) = &PyType_Type;
|
||||
if (PyType_Ready(&SHA256type) < 0)
|
||||
return NULL;
|
||||
return PyModule_Create(&_sha256module);
|
||||
|
||||
m = PyModule_Create(&_sha256module);
|
||||
if (m == NULL)
|
||||
return NULL;
|
||||
|
||||
Py_INCREF((PyObject *)&SHA224type);
|
||||
PyModule_AddObject(m, "SHA224Type", (PyObject *)&SHA224type);
|
||||
Py_INCREF((PyObject *)&SHA256type);
|
||||
PyModule_AddObject(m, "SHA256Type", (PyObject *)&SHA256type);
|
||||
return m;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue