diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-31 22:47:27 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-31 22:47:27 (GMT) |
| commit | 905a2ffe3e5445925a669ab433521ddb66cf1043 (patch) | |
| tree | f3a63e9771498b63eebb2797deaede3577695aaf /Modules/_io/textio.c | |
| parent | 9b661e6ef636bdd71639befc11e7ce71755f6421 (diff) | |
| download | cpython-905a2ffe3e5445925a669ab433521ddb66cf1043.zip cpython-905a2ffe3e5445925a669ab433521ddb66cf1043.tar.gz cpython-905a2ffe3e5445925a669ab433521ddb66cf1043.tar.bz2 | |
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.
........
Diffstat (limited to 'Modules/_io/textio.c')
| -rw-r--r-- | Modules/_io/textio.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index ba28d59..89d922c 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2318,15 +2318,7 @@ textiowrapper_truncate(textio *self, PyObject *args) return NULL; Py_DECREF(res); - if (pos != Py_None) { - res = PyObject_CallMethodObjArgs((PyObject *) self, - _PyIO_str_seek, pos, NULL); - if (res == NULL) - return NULL; - Py_DECREF(res); - } - - return PyObject_CallMethodObjArgs(self->buffer, _PyIO_str_truncate, NULL); + return PyObject_CallMethodObjArgs(self->buffer, _PyIO_str_truncate, pos, NULL); } static PyObject * |
