summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-04 10:28:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-04 10:28:52 (GMT)
commitbf009f0bceb9057a44e30b1b397163663ec69634 (patch)
treed89e05dcf2c20ee6bd1b76ffa7d869f1949d52d3 /Modules
parent5b99df68b08dc992a1b0b7784ce9f5410ecb8028 (diff)
parent0fc80c0d5a76ed59f3db0b3f15e1e37ccc127ffb (diff)
downloadcpython-bf009f0bceb9057a44e30b1b397163663ec69634.zip
cpython-bf009f0bceb9057a44e30b1b397163663ec69634.tar.gz
cpython-bf009f0bceb9057a44e30b1b397163663ec69634.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 OConnor.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_io/bufferedio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index a8631e0..b8043d4 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1155,6 +1155,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;