]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #809535: Mention behaviour of seek on text files.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 18 Oct 2003 09:37:12 +0000 (09:37 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 18 Oct 2003 09:37:12 +0000 (09:37 +0000)
Doc/lib/libstdtypes.tex
Objects/fileobject.c

index c3a03057704996c886a7f679f77c921ae4f3af1e..c38ea205bfbf3bb916236a4076463ac8325e74c2 100644 (file)
@@ -1345,7 +1345,12 @@ flush the read-ahead buffer.
   \method{seek()} operations will be undone at the next write.  If the
   file is only opened for writing in append mode (mode \code{'a'}),
   this method is essentially a no-op, but it remains useful for files
-  opened in append mode with reading enabled (mode \code{'a+'}).
+  opened in append mode with reading enabled (mode \code{'a+'}).  If the
+  file is opened in text mode (mode \code{'t'}), only offsets returned
+  by \method{tell()} are legal.  Use of other offsets causes undefined
+  behavior.
+
+  Note that not all file objects are seekable.
 \end{methoddesc}
 
 \begin{methoddesc}[file]{tell}{}
index 6a2b5fb9c5823e0e6e0a8a4f0361893820f36dcc..efbd6b66b9c56fb92666e03453d7a999468ff2d7 100644 (file)
@@ -1621,7 +1621,9 @@ PyDoc_STRVAR(seek_doc,
 "0 (offset from start of file, offset should be >= 0); other values are 1\n"
 "(move relative to current position, positive or negative), and 2 (move\n"
 "relative to end of file, usually negative, although many platforms allow\n"
-"seeking beyond the end of a file).\n"
+"seeking beyond the end of a file).  If the file is opened in text mode,\n"
+"only offsets returned by tell() are legal.  Use of other offsets causes\n"
+"undefined behavior."
 "\n"
 "Note that not all file objects are seekable.");