diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-03-31 08:25:59 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-03-31 08:25:59 (GMT) |
commit | 047f3b737608c799764f5e7d083764f42c9a1b42 (patch) | |
tree | 438a4bd91273e0eb35fa05f1189e52f0f0a12fc4 /Lib/_pyio.py | |
parent | ab0d198c7a6b2133ba5f782d7b951fef00ae615c (diff) | |
parent | 754aab28ed5f94338641db8899f89f59895c2137 (diff) | |
download | cpython-047f3b737608c799764f5e7d083764f42c9a1b42.zip cpython-047f3b737608c799764f5e7d083764f42c9a1b42.tar.gz cpython-047f3b737608c799764f5e7d083764f42c9a1b42.tar.bz2 |
Issue #22854: Merge UnsupportedOperation fixes from 3.5
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 972c082..354702e 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -390,7 +390,7 @@ class IOBase(metaclass=abc.ABCMeta): def seekable(self): """Return a bool indicating whether object supports random access. - If False, seek(), tell() and truncate() will raise UnsupportedOperation. + If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek(). """ return False @@ -405,7 +405,7 @@ class IOBase(metaclass=abc.ABCMeta): def readable(self): """Return a bool indicating whether object was opened for reading. - If False, read() will raise UnsupportedOperation. + If False, read() will raise OSError. """ return False @@ -419,7 +419,7 @@ class IOBase(metaclass=abc.ABCMeta): def writable(self): """Return a bool indicating whether object was opened for writing. - If False, write() and truncate() will raise UnsupportedOperation. + If False, write() and truncate() will raise OSError. """ return False @@ -787,12 +787,6 @@ class _BufferedIOMixin(BufferedIOBase): def seekable(self): return self.raw.seekable() - def readable(self): - return self.raw.readable() - - def writable(self): - return self.raw.writable() - @property def raw(self): return self._raw @@ -982,6 +976,9 @@ class BufferedReader(_BufferedIOMixin): self._reset_read_buf() self._read_lock = Lock() + def readable(self): + return self.raw.readable() + def _reset_read_buf(self): self._read_buf = b"" self._read_pos = 0 @@ -1170,6 +1167,9 @@ class BufferedWriter(_BufferedIOMixin): self._write_buf = bytearray() self._write_lock = Lock() + def writable(self): + return self.raw.writable() + def write(self, b): if self.closed: raise ValueError("write to closed file") |