Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52a42e9

Browse files
committed
Simplify initmd5() to use PyModule_AddIntConstant().
1 parent 8b14ac9 commit 52a42e9

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Modules/md5module.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,12 @@ static PyMethodDef md5_functions[] = {
268268
DL_EXPORT(void)
269269
initmd5(void)
270270
{
271-
PyObject *m, *d, *i;
271+
PyObject *m, *d;
272272

273273
MD5type.ob_type = &PyType_Type;
274274
m = Py_InitModule3("md5", md5_functions, module_doc);
275275
d = PyModule_GetDict(m);
276276
PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type);
277-
if ( (i = PyInt_FromLong(16)) != NULL)
278-
PyDict_SetItemString(d, "digest_size", i);
277+
PyModule_AddIntConstant(m, "digest_size", 16);
279278
/* No need to check the error here, the caller will do that */
280279
}

0 commit comments

Comments
 (0)