summaryrefslogtreecommitdiffstats
path: root/Modules/md5module.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2001-11-02 21:41:00 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2001-11-02 21:41:00 (GMT)
commit75fec2c8edd4cc673abf44d032ede17a63657ec1 (patch)
treeb6ecbeda6642e3552b5380f24dc4b429c8d6043c /Modules/md5module.c
parenta73f78b6ec9ae578aa030f65314d4b0d6ac34981 (diff)
downloadcpython-75fec2c8edd4cc673abf44d032ede17a63657ec1.zip
cpython-75fec2c8edd4cc673abf44d032ede17a63657ec1.tar.gz
cpython-75fec2c8edd4cc673abf44d032ede17a63657ec1.tar.bz2
[Patch #476612] Add attributes from PEP247 to the md5 and sha modules
Diffstat (limited to 'Modules/md5module.c')
-rw-r--r--Modules/md5module.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/md5module.c b/Modules/md5module.c
index 269a298..82bd415 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -161,6 +161,10 @@ static PyMethodDef md5_methods[] = {
static PyObject *
md5_getattr(md5object *self, char *name)
{
+ if (strcmp(name, "digest_size") == 0) {
+ return PyInt_FromLong(16);
+ }
+
return Py_FindMethod(md5_methods, (PyObject *)self, name);
}
@@ -264,11 +268,13 @@ static PyMethodDef md5_functions[] = {
DL_EXPORT(void)
initmd5(void)
{
- PyObject *m, *d;
+ PyObject *m, *d, *i;
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);
/* No need to check the error here, the caller will do that */
}