[Python-checkins] python/dist/src/Modules binascii.c,2.33,2.33.4.1

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
2002年8月15日 15:18:13 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv14843/Modules
Modified Files:
 Tag: release22-maint
	binascii.c 
Log Message:
Backport of fix for SF bug #595671 from Python 2.3cvs:
 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.
One addition here is that there was no test of the base64 module in
Python 2.2 cvs yet, so I added that too.
Index: binascii.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v
retrieving revision 2.33
retrieving revision 2.33.4.1
diff -C2 -d -r2.33 -r2.33.4.1
*** binascii.c	19 Dec 2001 04:41:35 -0000	2.33
--- binascii.c	15 Aug 2002 22:18:11 -0000	2.33.4.1
***************
*** 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 によって変換されたページ (->オリジナル) /