[Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.100,2.101

Guido van Rossum python-dev@python.org
Sun, 07 Jan 2001 17:26:49 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv13967

Modified Files:
	fileobject.c 
Log Message:
Let's hope that three time's a charm...

Tim discovered another "bug" in my get_line() code: while the comments
said that n<0 was invalid, it was in fact still called with n<0 (when
PyFile_GetLine() was called with n<0).  In that case fortunately
executed the same code as for n==0.

Changed the comment to admit this fact, and changed Tim's MS speed
hack code to use 'n <= 0' as the criteria for the speed hack.


Index: fileobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v
retrieving revision 2.100
retrieving revision 2.101
diff -C2 -r2.100 -r2.101
*** fileobject.c	2001/01/08 00:53:12	2.100
--- fileobject.c	2001/01/08 01:26:47	2.101
***************
*** 805,810 ****
     Size argument interpretation:
     > 0: max length;
!    = 0: read arbitrary line;
!    < 0: invalid
  */
  
--- 805,809 ----
     Size argument interpretation:
     > 0: max length;
!    <= 0: read arbitrary line
  */
  
***************
*** 829,833 ****
  
  #ifdef USE_MS_GETLINE_HACK
! 	if (n == 0)
  		return ms_getline_hack(fp);
  #endif
--- 828,833 ----
  
  #ifdef USE_MS_GETLINE_HACK
! 	
! 	if (n <= 0)
  		return ms_getline_hack(fp);
  #endif