The bufsize parameter is now deprecated and ignored.
.. versionchanged:: 3.2
Can be used as a context manager.
- .. versionchanged:: 3.5.2
- The *bufsize* parameter is no longer used.
-
++ .. deprecated-removed:: 3.6 3.8
++ The *bufsize* parameter.
The following functions use the global state created by :func:`fileinput.input`;
if there is no active state, :exc:`RuntimeError` is raised.
Can be used as a context manager.
.. deprecated:: 3.4
- The ``'rU'`` and ``'U'`` modes.
+ The ``'rU'`` and ``'U'`` modes.
+
- .. versionchanged:: 3.5.2
- The *bufsize* parameter is no longer used.
++ .. deprecated-removed:: 3.6 3.8
++ The *bufsize* parameter.
**Optional in-place filtering:** if the keyword argument ``inplace=True`` is
_state = None
-# No longer used
--DEFAULT_BUFSIZE = 8*1024
--
def input(files=None, inplace=False, backup="", bufsize=0,
mode="r", openhook=None):
"""Return an instance of the FileInput class, which can be iterated.
self._files = files
self._inplace = inplace
self._backup = backup
- self._bufsize = bufsize or DEFAULT_BUFSIZE
++ if bufsize:
++ import warnings
++ warnings.warn('bufsize is deprecated and ignored',
++ DeprecationWarning, stacklevel=2)
self._savestdout = None
self._output = None
self._filename = None
t2 = writeTmp(2, ["Line %s of file 2\n" % (i+1) for i in range(10)])
t3 = writeTmp(3, ["Line %s of file 3\n" % (i+1) for i in range(5)])
t4 = writeTmp(4, ["Line %s of file 4\n" % (i+1) for i in range(1)])
-- self.buffer_size_test(t1, t2, t3, t4, bs, round)
++ if bs:
++ with self.assertWarns(DeprecationWarning):
++ self.buffer_size_test(t1, t2, t3, t4, bs, round)
++ else:
++ self.buffer_size_test(t1, t2, t3, t4, bs, round)
finally:
remove_tempfiles(t1, t2, t3, t4)
check('rb', ['A\n', 'B\r\n', 'C\r', 'D\u20ac'])
- blacklist = {'DEFAULT_BUFSIZE'}
- support.check__all__(self, fileinput, blacklist=blacklist)
+class MiscTest(unittest.TestCase):
+
+ def test_all(self):
++ support.check__all__(self, fileinput)
+
+
if __name__ == "__main__":
unittest.main()
Library
-------
-- Issue #15068: Got rid of excessive buffering in the fileinput module.
- The bufsize parameter is no longer used.
++- Issue #15068: Got rid of excessive buffering in fileinput.
++ The bufsize parameter is now deprecated and ignored.
++
+- Issue #19475: Added an optional argument timespec to the datetime
+ isoformat() method to choose the precision of the time component.
- Issue #2202: Fix UnboundLocalError in
AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu Dupuy.