diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-31 22:26:04 +0000 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-31 22:26:04 +0000 |
commit | f3fa07470381b4f54b2d3f911fc22624e9b0b27d (patch) | |
tree | 5368b993641d34b3824a79896bf18c8f9097ce5c /Modules/_io/bytesio.c | |
parent | e70c72c06b169a36170ab68ec52bda9a87c16274 (diff) | |
download | cpython-git-f3fa07470381b4f54b2d3f911fc22624e9b0b27d.tar.gz |
- 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.
Diffstat (limited to 'Modules/_io/bytesio.c')
-rw-r--r-- | Modules/_io/bytesio.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index d25cb673f5..25ff2471b6 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -414,7 +414,7 @@ PyDoc_STRVAR(truncate_doc, "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) @@ -453,7 +453,6 @@ bytesio_truncate(bytesio *self, PyObject *args) if (resize_buffer(self, size) < 0) return NULL; } - self->pos = size; return PyLong_FromSsize_t(size); } |