bpo-36952: Remove the bufsize parameter in fileinput.input(). (GH-13400)
This parameter is marked as deprecated since 3.6 and for removal in 3.8.
It already had no effects.
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index 0764aa5..d868e74 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -80,8 +80,7 @@
_state = None
-def input(files=None, inplace=False, backup="", bufsize=0,
- mode="r", openhook=None):
+def input(files=None, inplace=False, backup="", *, mode="r", openhook=None):
"""Return an instance of the FileInput class, which can be iterated.
The parameters are passed to the constructor of the FileInput class.
@@ -91,7 +90,7 @@
global _state
if _state and _state._file:
raise RuntimeError("input() already active")
- _state = FileInput(files, inplace, backup, bufsize, mode, openhook)
+ _state = FileInput(files, inplace, backup, mode=mode, openhook=openhook)
return _state
def close():
@@ -173,7 +172,7 @@
return _state.isstdin()
class FileInput:
- """FileInput([files[, inplace[, backup[, bufsize, [, mode[, openhook]]]]]])
+ """FileInput([files[, inplace[, backup]]], *, mode=None, openhook=None)
Class FileInput is the implementation of the module; its methods
filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
@@ -185,7 +184,7 @@
sequential order; random access and readline() cannot be mixed.
"""
- def __init__(self, files=None, inplace=False, backup="", bufsize=0,
+ def __init__(self, files=None, inplace=False, backup="", *,
mode="r", openhook=None):
if isinstance(files, str):
files = (files,)
@@ -201,10 +200,6 @@
self._files = files
self._inplace = inplace
self._backup = backup
- if bufsize:
- import warnings
- warnings.warn('bufsize is deprecated and ignored',
- DeprecationWarning, stacklevel=2)
self._savestdout = None
self._output = None
self._filename = None