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.
........
This commit is contained in:
Antoine Pitrou 2010-01-31 22:47:27 +00:00
parent 9b661e6ef6
commit 905a2ffe3e
12 changed files with 97 additions and 47 deletions

View file

@ -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 *