[Python-checkins] python/dist/src/Modules zipimport.c,1.8,1.9

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
2003年2月17日 10:05:23 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv9924/Modules
Modified Files:
	zipimport.c 
Log Message:
Use correct function name to PyArg_ParseTuple("is_package").
Fix off-by-1 error in normalize_line_endings():
 when *p == '0円' the NUL was copied into q and q was auto-incremented,
 the loop was broken out of,
 then a newline was appended followed by a NUL.
 So the function, in effect, was strcpy() but added two extra chars
 which was caught by obmalloc in debug mode, since there was only
 room for 1 additional newline.
Get test working under regrtest (added test_main).
Index: zipimport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** zipimport.c	3 Jan 2003 11:18:55 -0000	1.8
--- zipimport.c	17 Feb 2003 18:05:19 -0000	1.9
***************
*** 372,376 ****
 	enum module_info mi;
 
! 	if (!PyArg_ParseTuple(args, "s:zipimporter.find_module",
 			 &fullname))
 		return NULL;
--- 372,376 ----
 	enum module_info mi;
 
! 	if (!PyArg_ParseTuple(args, "s:zipimporter.is_package",
 			 &fullname))
 		return NULL;
***************
*** 948,952 ****
 	}
 	/* replace "\r\n?" by "\n" */
! 	for (q = buf;;) {
 		if (*p == '\r') {
 			*q++ = '\n';
--- 948,952 ----
 	}
 	/* replace "\r\n?" by "\n" */
! 	for (q = buf; *p != '0円'; p++) {
 		if (*p == '\r') {
 			*q++ = '\n';
***************
*** 956,962 ****
 		else
 			*q++ = *p;
- 		if (*p == '0円')
- 			break;
- 		p++;
 	}
 	*q++ = '\n'; /* add trailing \n */
--- 956,959 ----

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