[Python-checkins] CVS: python/dist/src/Modules md5module.c,2.24,2.25 shamodule.c,2.14,2.15

A.M. Kuchling akuchling@users.sourceforge.net
2001年11月02日 13:41:02 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv15179
Modified Files:
	md5module.c shamodule.c 
Log Message:
[Patch #476612] Add attributes from PEP247 to the md5 and sha modules
Index: md5module.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/md5module.c,v
retrieving revision 2.24
retrieving revision 2.25
diff -C2 -d -r2.24 -r2.25
*** md5module.c	2000年09月01日 23:29:26	2.24
--- md5module.c	2001年11月02日 21:41:00	2.25
***************
*** 162,165 ****
--- 162,169 ----
 md5_getattr(md5object *self, char *name)
 {
+ if (strcmp(name, "digest_size") == 0) {
+ 		return PyInt_FromLong(16);
+ }
+ 
 	return Py_FindMethod(md5_methods, (PyObject *)self, name);
 }
***************
*** 265,269 ****
 initmd5(void)
 {
! 	PyObject *m, *d;
 
 MD5type.ob_type = &PyType_Type;
--- 269,273 ----
 initmd5(void)
 {
! 	PyObject *m, *d, *i;
 
 MD5type.ob_type = &PyType_Type;
***************
*** 271,274 ****
--- 275,280 ----
 	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 */
 }
Index: shamodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/shamodule.c,v
retrieving revision 2.14
retrieving revision 2.15
diff -C2 -d -r2.14 -r2.15
*** shamodule.c	2001年01月29日 22:46:35	2.14
--- shamodule.c	2001年11月02日 21:41:00	2.15
***************
*** 6,10 ****
 based upon. Additional work performed by:
 
! Andrew Kuchling (amk1@bigfoot.com)
 Greg Stein (gstein@lyra.org)
 */
--- 6,10 ----
 based upon. Additional work performed by:
 
! Andrew Kuchling (akuchlin@mems-exchange.org)
 Greg Stein (gstein@lyra.org)
 */
***************
*** 459,464 ****
 if (strcmp(name, "blocksize")==0)
 return PyInt_FromLong(1);
! if (strcmp(name, "digestsize")==0)
! return PyInt_FromLong(20);
 
 return Py_FindMethod(SHA_methods, self, name);
--- 459,464 ----
 if (strcmp(name, "blocksize")==0)
 return PyInt_FromLong(1);
! if (strcmp(name, "digest_size")==0 || strcmp(name, "digestsize")==0)
! 	return PyInt_FromLong(20);
 
 return Py_FindMethod(SHA_methods, self, name);
***************
*** 543,545 ****
--- 543,546 ----
 blocks */ 
 insint("digestsize", 20);
+ insint("digest_size", 20);
 }

AltStyle によって変換されたページ (->オリジナル) /