Commit 7a66c9df authored by Guido van Rossum's avatar Guido van Rossum

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.
parent 19db2f65
...@@ -804,8 +804,7 @@ ms_getline_hack(FILE *fp) ...@@ -804,8 +804,7 @@ ms_getline_hack(FILE *fp)
/* Internal routine to get a line. /* Internal routine to get a line.
Size argument interpretation: Size argument interpretation:
> 0: max length; > 0: max length;
= 0: read arbitrary line; <= 0: read arbitrary line
< 0: invalid
*/ */
#ifdef HAVE_GETC_UNLOCKED #ifdef HAVE_GETC_UNLOCKED
...@@ -828,7 +827,8 @@ get_line(PyFileObject *f, int n) ...@@ -828,7 +827,8 @@ get_line(PyFileObject *f, int n)
PyObject *v; PyObject *v;
#ifdef USE_MS_GETLINE_HACK #ifdef USE_MS_GETLINE_HACK
if (n == 0)
if (n <= 0)
return ms_getline_hack(fp); return ms_getline_hack(fp);
#endif #endif
n2 = n > 0 ? n : 100; n2 = n > 0 ? n : 100;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment