[Python-checkins] r55008 - in python/branches/release25-maint: Doc/lib/libstdtypes.tex Misc/NEWS

brett.cannon python-checkins at python.org
Sat Apr 28 00:36:06 CEST 2007


Author: brett.cannon
Date: Sat Apr 28 00:35:57 2007
New Revision: 55008

Modified:
   python/branches/release25-maint/Doc/lib/libstdtypes.tex
   python/branches/release25-maint/Misc/NEWS
Log:
Backport r54712: document that calling file.next() on a file open for writing
leads to undefined behaviour.


Modified: python/branches/release25-maint/Doc/lib/libstdtypes.tex
==============================================================================
--- python/branches/release25-maint/Doc/lib/libstdtypes.tex	(original)
+++ python/branches/release25-maint/Doc/lib/libstdtypes.tex	Sat Apr 28 00:35:57 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/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Sat Apr 28 00:35:57 2007
@@ -25,6 +25,13 @@
   run in verbose mode.
 
 
+Documentation
+-------------
+
+- Bug #1569057: Document that calling file.next() on a file open for writing
+  has undefined behaviour.  Backport of r54712.
+
+
 What's New in Python 2.5.1?
 =============================
 


More information about the Python-checkins mailing list