diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-12-21 21:26:09 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-12-21 21:26:09 (GMT) |
commit | 6cfc5124f2a615922d32ac19a319ffab8edaad0f (patch) | |
tree | 1d6b68e8021f9e1e10d7b32fad7708e39f4b30de /Lib/_pyio.py | |
parent | 9fc6b6c4536417283c6f52b6dfb4c82afb372448 (diff) | |
download | cpython-6cfc5124f2a615922d32ac19a319ffab8edaad0f.zip cpython-6cfc5124f2a615922d32ac19a319ffab8edaad0f.tar.gz cpython-6cfc5124f2a615922d32ac19a319ffab8edaad0f.tar.bz2 |
Merged revisions 87427 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87427 | antoine.pitrou | 2010-12-21 22:20:59 +0100 (mar., 21 déc. 2010) | 3 lines
Issue #10750: The `raw` attribute of buffered IO objects is now read-only.
........
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 4485233..b350bd4 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -674,7 +674,7 @@ class _BufferedIOMixin(BufferedIOBase): """ def __init__(self, raw): - self.raw = raw + self._raw = raw ### Positioning ### @@ -718,8 +718,8 @@ class _BufferedIOMixin(BufferedIOBase): if self.raw is None: raise ValueError("raw stream already detached") self.flush() - raw = self.raw - self.raw = None + raw = self._raw + self._raw = None return raw ### Inquiries ### @@ -734,6 +734,10 @@ class _BufferedIOMixin(BufferedIOBase): return self.raw.writable() @property + def raw(self): + return self._raw + + @property def closed(self): return self.raw.closed @@ -1444,7 +1448,7 @@ class TextIOWrapper(TextIOBase): if not isinstance(errors, str): raise ValueError("invalid errors: %r" % errors) - self.buffer = buffer + self._buffer = buffer self._line_buffering = line_buffering self._encoding = encoding self._errors = errors @@ -1499,6 +1503,10 @@ class TextIOWrapper(TextIOBase): def line_buffering(self): return self._line_buffering + @property + def buffer(self): + return self._buffer + def seekable(self): return self._seekable @@ -1713,8 +1721,8 @@ class TextIOWrapper(TextIOBase): if self.buffer is None: raise ValueError("buffer is already detached") self.flush() - buffer = self.buffer - self.buffer = None + buffer = self._buffer + self._buffer = None return buffer def seek(self, cookie, whence=0): |