Bug #1396471: Document that Windows' ftell() can return invalid
authorGeorg Brandl <georg@python.org>
Fri, 20 Jan 2006 09:14:36 +0000 (09:14 +0000)
committerGeorg Brandl <georg@python.org>
Fri, 20 Jan 2006 09:14:36 +0000 (09:14 +0000)
values for text files with UNIX-style line endings.

Doc/lib/libstdtypes.tex
Misc/NEWS

index 656cb739b8d8889d0491b12d559f49869b4d3790..c2a7c88aa69a22d5d50c7ec457395ef88755d959 100644 (file)
@@ -625,7 +625,7 @@ characters is assumed.
 \begin{methoddesc}[string]{find}{sub\optional{, start\optional{, end}}}
 Return the lowest index in the string where substring \var{sub} is
 found, such that \var{sub} is contained in the range [\var{start},
-\var{end}).  Optional arguments \var{start} and \var{end} are
+\var{end}].  Optional arguments \var{start} and \var{end} are
 interpreted as in slice notation.  Return \code{-1} if \var{sub} is
 not found.
 \end{methoddesc}
@@ -1598,6 +1598,10 @@ flush the read-ahead buffer.
 \begin{methoddesc}[file]{tell}{}
   Return the file's current position, like \code{stdio}'s
   \cfunction{ftell()}.
+
+  \note{On Windows, \method{tell()} can return illegal values (after an
+  \cfunction{fgets()}) when reading files with \UNIX{}-style line-endings.
+  Use binary mode (\code{'rb'}) to circumvent this problem.}
 \end{methoddesc}
 
 \begin{methoddesc}[file]{truncate}{\optional{size}}
index 62d9c8b1518ac8bbd37caa3594fc7ea7545dba3e..1662110012f617c9548ae298c2a180c7c499fb81 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -727,6 +727,9 @@ Tests
 Documentation
 -------------
 
+- Bug #1396471: Document that Windows' ftell() can return invalid
+  values for text files with UNIX-style line endings.
+
 - Bug #1274828: Document os.path.splitunc().
 
 - Bug #1190204: Clarify which directories are searched by site.py.