diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-07-07 15:03:22 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-07-07 15:03:22 (GMT) |
commit | 109d57358e9078fb1139e2b7687d7e300ce4dcb4 (patch) | |
tree | a485bc26bf29cad1d4e8b9c13c82ae09cab8235e /Lib | |
parent | af1adbeedd9717fa8cfd47b3fa248a8169d7ef8e (diff) | |
download | cpython-109d57358e9078fb1139e2b7687d7e300ce4dcb4.zip cpython-109d57358e9078fb1139e2b7687d7e300ce4dcb4.tar.gz cpython-109d57358e9078fb1139e2b7687d7e300ce4dcb4.tar.bz2 |
Issue #13248: io: Remove obsolete argument "max_buffer_size" of BufferedWriter and BufferedRWPair.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/_pyio.py | 22 | ||||
-rw-r--r-- | Lib/test/test_io.py | 10 |
2 files changed, 8 insertions, 24 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index c06f4b8..1ce61e9 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -5,7 +5,6 @@ Python implementation of the io module. import os import abc import codecs -import warnings import errno # Import _thread instead of threading to reduce startup cost try: @@ -1065,19 +1064,13 @@ class BufferedWriter(_BufferedIOMixin): DEFAULT_BUFFER_SIZE. """ - _warning_stack_offset = 2 - - def __init__(self, raw, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): + def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): if not raw.writable(): raise IOError('"raw" argument must be writable.') _BufferedIOMixin.__init__(self, raw) if buffer_size <= 0: raise ValueError("invalid buffer size") - if max_buffer_size is not None: - warnings.warn("max_buffer_size is deprecated", DeprecationWarning, - self._warning_stack_offset) self.buffer_size = buffer_size self._write_buf = bytearray() self._write_lock = Lock() @@ -1167,15 +1160,11 @@ class BufferedRWPair(BufferedIOBase): # XXX The usefulness of this (compared to having two separate IO # objects) is questionable. - def __init__(self, reader, writer, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): + def __init__(self, reader, writer, buffer_size=DEFAULT_BUFFER_SIZE): """Constructor. The arguments are two RawIO instances. """ - if max_buffer_size is not None: - warnings.warn("max_buffer_size is deprecated", DeprecationWarning, 2) - if not reader.readable(): raise IOError('"reader" argument must be readable.') @@ -1232,13 +1221,10 @@ class BufferedRandom(BufferedWriter, BufferedReader): defaults to DEFAULT_BUFFER_SIZE. """ - _warning_stack_offset = 3 - - def __init__(self, raw, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): + def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): raw._checkSeekable() BufferedReader.__init__(self, raw, buffer_size) - BufferedWriter.__init__(self, raw, buffer_size, max_buffer_size) + BufferedWriter.__init__(self, raw, buffer_size) def seek(self, pos, whence=0): if whence not in valid_seek_flags: diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 54ba179..ed8564c 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1255,9 +1255,8 @@ class BufferedWriterTest(unittest.TestCase, CommonBufferedTests): self.assertRaises(IOError, bufio.tell) self.assertRaises(IOError, bufio.write, b"abcdef") - def test_max_buffer_size_deprecation(self): - with support.check_warnings(("max_buffer_size is deprecated", - DeprecationWarning)): + def test_max_buffer_size_removal(self): + with self.assertRaises(TypeError): self.tp(self.MockRawIO(), 8, 12) @@ -1313,9 +1312,8 @@ class BufferedRWPairTest(unittest.TestCase): pair = self.tp(self.MockRawIO(), self.MockRawIO()) self.assertRaises(self.UnsupportedOperation, pair.detach) - def test_constructor_max_buffer_size_deprecation(self): - with support.check_warnings(("max_buffer_size is deprecated", - DeprecationWarning)): + def test_constructor_max_buffer_size_removal(self): + with self.assertRaises(TypeError): self.tp(self.MockRawIO(), self.MockRawIO(), 8, 12) def test_constructor_with_not_readable(self): |