mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Simplify initmd5() to use PyModule_AddIntConstant().
This commit is contained in:
parent
8b14ac9898
commit
52a42e9888
1 changed files with 2 additions and 3 deletions
|
@ -268,13 +268,12 @@ static PyMethodDef md5_functions[] = {
|
|||
DL_EXPORT(void)
|
||||
initmd5(void)
|
||||
{
|
||||
PyObject *m, *d, *i;
|
||||
PyObject *m, *d;
|
||||
|
||||
MD5type.ob_type = &PyType_Type;
|
||||
m = Py_InitModule3("md5", md5_functions, module_doc);
|
||||
d = PyModule_GetDict(m);
|
||||
PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type);
|
||||
if ( (i = PyInt_FromLong(16)) != NULL)
|
||||
PyDict_SetItemString(d, "digest_size", i);
|
||||
PyModule_AddIntConstant(m, "digest_size", 16);
|
||||
/* No need to check the error here, the caller will do that */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue