From: Fred Drake Date: Fri, 2 Nov 2001 22:05:06 +0000 (+0000) Subject: Simplify initmd5() to use PyModule_AddIntConstant(). X-Git-Tag: v2.2.1c1~894 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52a42e9888581ad4f6bc9ca0ba2931d8b3d55ac3;p=python Simplify initmd5() to use PyModule_AddIntConstant(). --- diff --git a/Modules/md5module.c b/Modules/md5module.c index 82bd415d76..beb743f765 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -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 */ }