[Python-checkins] python/dist/src/Modules binascii.c,2.37,2.38

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
2002年8月15日 15:14:26 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv13052/Modules
Modified Files:
	binascii.c 
Log Message:
base64.decodestring('') should return '' instead of raising an
exception. The bug fix for SF #430849 wasn't quite right. This
closes SF bug #595671. I'll backport this to Python 2.2.
Index: binascii.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v
retrieving revision 2.37
retrieving revision 2.38
diff -C2 -d -r2.37 -r2.38
*** binascii.c	2 Aug 2002 02:27:13 -0000	2.37
--- binascii.c	15 Aug 2002 22:14:24 -0000	2.38
***************
*** 347,354 ****
 		return NULL;
 
- 	if ( ascii_len == 0) {
- 		PyErr_SetString(Error, "Cannot decode empty input");
- 		return NULL;
- 	}
 	bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */
 
--- 347,350 ----
***************
*** 414,418 ****
 
 	/* and set string size correctly */
! 	_PyString_Resize(&rv, bin_len);
 	return rv;
 }
--- 410,415 ----
 
 	/* and set string size correctly */
! 	if (bin_len > 0)
! 		_PyString_Resize(&rv, bin_len);
 	return rv;
 }

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