Merged revisions 77890 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77890 | antoine.pitrou | 2010-01-31 23:26:04 +0100 (dim., 31 janv. 2010) | 7 lines

  - Issue #6939: Fix file I/O objects in the `io` module to keep the original
    file position when calling `truncate()`.  It would previously change the
    file position to the given argument, which goes against the tradition of
    ftruncate() and other truncation APIs.  Patch by Pascal Chambon.
........
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 5ca878d..1482d82 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -412,7 +412,7 @@
 "truncate([size]) -> int.  Truncate the file to at most size bytes.\n"
 "\n"
 "Size defaults to the current file position, as returned by tell().\n"
-"Returns the new size.  Imply an absolute seek to the position size.");
+"The current file position is unchanged.  Returns the new size.\n");
 
 static PyObject *
 bytesio_truncate(bytesio *self, PyObject *args)
@@ -451,7 +451,6 @@
         if (resize_buffer(self, size) < 0)
             return NULL;
     }
-    self->pos = size;
 
     return PyLong_FromSsize_t(size);
 }