[Python-checkins] r54712 - in python/trunk: Doc/lib/libstdtypes.tex Misc/NEWS
brett.cannon
python-checkins at python.org
Sun Apr 8 06:29:33 CEST 2007
Author: brett.cannon
Date: Sun Apr 8 06:29:32 2007
New Revision: 54712
Modified:
python/trunk/Doc/lib/libstdtypes.tex
python/trunk/Misc/NEWS
Log:
Doc that file.next() has undefined behaviour when called on a file opened with
'w'. Closes bug #1569057.
To be backported once 2.5 branch is unfrozen.
Modified: python/trunk/Doc/lib/libstdtypes.tex
==============================================================================
--- python/trunk/Doc/lib/libstdtypes.tex (original)
+++ python/trunk/Doc/lib/libstdtypes.tex Sun Apr 8 06:29:32 2007
@@ -1615,14 +1615,15 @@
iterator, typically in a \keyword{for} loop (for example,
\code{for line in f: print line}), the \method{next()} method is
called repeatedly. This method returns the next input line, or raises
-\exception{StopIteration} when \EOF{} is hit. In order to make a
-\keyword{for} loop the most efficient way of looping over the lines of
-a file (a very common operation), the \method{next()} method uses a
-hidden read-ahead buffer. As a consequence of using a read-ahead
-buffer, combining \method{next()} with other file methods (like
-\method{readline()}) does not work right. However, using
-\method{seek()} to reposition the file to an absolute position will
-flush the read-ahead buffer.
+\exception{StopIteration} when \EOF{} is hit when the file is open for
+reading (behavior is undefined when the file is open for writing). In
+order to make a \keyword{for} loop the most efficient way of looping
+over the lines of a file (a very common operation), the
+\method{next()} method uses a hidden read-ahead buffer. As a
+consequence of using a read-ahead buffer, combining \method{next()}
+with other file methods (like \method{readline()}) does not work
+right. However, using \method{seek()} to reposition the file to an
+absolute position will flush the read-ahead buffer.
\versionadded{2.3}
\end{methoddesc}
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sun Apr 8 06:29:32 2007
@@ -736,6 +736,9 @@
Documentation
-------------
+- Bug #1569057: Document that calling file.next() when the file is open for
+ writing is undefined.
+
- Patch #1489771: the syntax rules in Python Reference Manual were
updated to reflect the current Python syntax.
More information about the Python-checkins
mailing list