diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-04 10:26:20 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-04 10:26:20 (GMT) |
commit | 1e44fecc52da8fb47ab51a000c48e0ce8f36064c (patch) | |
tree | 402d41816f79d63ccfd1f8d296c0a4e6d3e32b1a /Modules/_io/bufferedio.c | |
parent | 94190bb6e7f3b1c7942b562fe0fad3e62b5386b9 (diff) | |
download | cpython-1e44fecc52da8fb47ab51a000c48e0ce8f36064c.zip cpython-1e44fecc52da8fb47ab51a000c48e0ce8f36064c.tar.gz cpython-1e44fecc52da8fb47ab51a000c48e0ce8f36064c.tar.bz2 |
Issue #13087: BufferedReader.seek() now always raises UnsupportedOperation
if the underlying raw stream is unseekable, even if the seek could be
satisfied using the internal buffer. Patch by John O'Connor.
Diffstat (limited to 'Modules/_io/bufferedio.c')
-rw-r--r-- | Modules/_io/bufferedio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index d6f0c9c..bd1aae5 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1086,6 +1086,9 @@ buffered_seek(buffered *self, PyObject *args) CHECK_CLOSED(self, "seek of closed file") + if (_PyIOBase_check_seekable(self->raw, Py_True) == NULL) + return NULL; + target = PyNumber_AsOff_t(targetobj, PyExc_ValueError); if (target == -1 && PyErr_Occurred()) return NULL; |